[libc] add locale proxy header (#130621)
Address review comments in #130407. This patch is already covered by existing locale test cases.
This commit is contained in:
@@ -183,6 +183,15 @@ add_proxy_header_library(
|
|||||||
libc.include.link
|
libc.include.link
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_proxy_header_library(
|
||||||
|
locale_macros
|
||||||
|
HDRS
|
||||||
|
locale_macros.h
|
||||||
|
FULL_BUILD_DEPENDS
|
||||||
|
libc.include.llvm-libc-macros.locale_macros
|
||||||
|
libc.include.locale
|
||||||
|
)
|
||||||
|
|
||||||
add_proxy_header_library(
|
add_proxy_header_library(
|
||||||
sys_auxv_macros
|
sys_auxv_macros
|
||||||
HDRS
|
HDRS
|
||||||
|
|||||||
22
libc/hdr/locale_macros.h
Normal file
22
libc/hdr/locale_macros.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
//===-- Definition of macros from locale.h --------------------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_HDR_LOCALE_MACROS_H
|
||||||
|
#define LLVM_LIBC_HDR_LOCALE_MACROS_H
|
||||||
|
|
||||||
|
#ifdef LIBC_FULL_BUILD
|
||||||
|
|
||||||
|
#include "include/llvm-libc-macros/locale-macros.h"
|
||||||
|
|
||||||
|
#else // Overlay mode
|
||||||
|
|
||||||
|
#error "macros not available in overlay mode"
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_FULL_BUILD
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_HDR_LOCALE_MACROS_H
|
||||||
@@ -7,7 +7,7 @@ add_libc_test(
|
|||||||
SRCS
|
SRCS
|
||||||
locale_test.cpp
|
locale_test.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
libc.include.locale
|
libc.hdr.locale_macros
|
||||||
libc.src.locale.newlocale
|
libc.src.locale.newlocale
|
||||||
libc.src.locale.uselocale
|
libc.src.locale.uselocale
|
||||||
libc.src.locale.freelocale
|
libc.src.locale.freelocale
|
||||||
@@ -20,6 +20,6 @@ add_libc_test(
|
|||||||
SRCS
|
SRCS
|
||||||
localeconv_test.cpp
|
localeconv_test.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
libc.include.locale
|
libc.hdr.locale_macros
|
||||||
libc.src.locale.localeconv
|
libc.src.locale.localeconv
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,14 +6,12 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "hdr/locale_macros.h"
|
||||||
#include "src/locale/freelocale.h"
|
#include "src/locale/freelocale.h"
|
||||||
#include "src/locale/newlocale.h"
|
#include "src/locale/newlocale.h"
|
||||||
#include "src/locale/uselocale.h"
|
#include "src/locale/uselocale.h"
|
||||||
|
|
||||||
#include "test/UnitTest/Test.h"
|
#include "test/UnitTest/Test.h"
|
||||||
|
|
||||||
#include "include/llvm-libc-macros/locale-macros.h"
|
|
||||||
|
|
||||||
TEST(LlvmLibcLocale, DefaultLocale) {
|
TEST(LlvmLibcLocale, DefaultLocale) {
|
||||||
locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C", nullptr);
|
locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C", nullptr);
|
||||||
EXPECT_NE(new_locale, static_cast<locale_t>(nullptr));
|
EXPECT_NE(new_locale, static_cast<locale_t>(nullptr));
|
||||||
|
|||||||
@@ -6,9 +6,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "include/llvm-libc-macros/locale-macros.h"
|
#include "hdr/locale_macros.h"
|
||||||
#include "src/locale/localeconv.h"
|
#include "src/locale/localeconv.h"
|
||||||
|
|
||||||
#include "test/UnitTest/Test.h"
|
#include "test/UnitTest/Test.h"
|
||||||
|
|
||||||
TEST(LlvmLibcLocale, DefaultLocale) {
|
TEST(LlvmLibcLocale, DefaultLocale) {
|
||||||
|
|||||||
Reference in New Issue
Block a user