Skip to content

Commit 426caf1

Browse files
authored
[libc] add locale proxy header (llvm#130621)
Address review comments in llvm#130407. This patch is already covered by existing locale test cases.
1 parent a5a33d8 commit 426caf1

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

libc/hdr/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ add_proxy_header_library(
183183
libc.include.link
184184
)
185185

186+
add_proxy_header_library(
187+
locale_macros
188+
HDRS
189+
locale_macros.h
190+
FULL_BUILD_DEPENDS
191+
libc.include.llvm-libc-macros.locale_macros
192+
libc.include.locale
193+
)
194+
186195
add_proxy_header_library(
187196
sys_auxv_macros
188197
HDRS

libc/hdr/locale_macros.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Definition of macros from locale.h --------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_HDR_LOCALE_MACROS_H
10+
#define LLVM_LIBC_HDR_LOCALE_MACROS_H
11+
12+
#ifdef LIBC_FULL_BUILD
13+
14+
#include "include/llvm-libc-macros/locale-macros.h"
15+
16+
#else // Overlay mode
17+
18+
#error "macros not available in overlay mode"
19+
20+
#endif // LLVM_LIBC_FULL_BUILD
21+
22+
#endif // LLVM_LIBC_HDR_LOCALE_MACROS_H

libc/test/src/locale/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_libc_test(
77
SRCS
88
locale_test.cpp
99
DEPENDS
10-
libc.include.locale
10+
libc.hdr.locale_macros
1111
libc.src.locale.newlocale
1212
libc.src.locale.uselocale
1313
libc.src.locale.freelocale
@@ -20,6 +20,6 @@ add_libc_test(
2020
SRCS
2121
localeconv_test.cpp
2222
DEPENDS
23-
libc.include.locale
23+
libc.hdr.locale_macros
2424
libc.src.locale.localeconv
2525
)

libc/test/src/locale/locale_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "hdr/locale_macros.h"
910
#include "src/locale/freelocale.h"
1011
#include "src/locale/newlocale.h"
1112
#include "src/locale/uselocale.h"
12-
1313
#include "test/UnitTest/Test.h"
1414

15-
#include "include/llvm-libc-macros/locale-macros.h"
16-
1715
TEST(LlvmLibcLocale, DefaultLocale) {
1816
locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C", nullptr);
1917
EXPECT_NE(new_locale, static_cast<locale_t>(nullptr));

libc/test/src/locale/localeconv_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "include/llvm-libc-macros/locale-macros.h"
9+
#include "hdr/locale_macros.h"
1010
#include "src/locale/localeconv.h"
11-
1211
#include "test/UnitTest/Test.h"
1312

1413
TEST(LlvmLibcLocale, DefaultLocale) {

0 commit comments

Comments
 (0)