[libc++] Move the #error message for no localization to <locale.h>

<locale.h> is lower level than <__locale>, so that's where we want the
error to live for systems that don't provide localization support.
This commit is contained in:
Louis Dionne 2020-10-28 09:26:56 -04:00
parent 201184b30b
commit 91336a0c61
9 changed files with 28 additions and 17 deletions

View File

@ -11,11 +11,6 @@
#define _LIBCPP___LOCALE
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
# error "Localization is not supported by this configuration of libc++"
#endif
#include <string>
#include <memory>
#include <utility>

View File

@ -35,8 +35,12 @@ Functions:
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
# error "Localization is not supported by this configuration of libc++"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
# pragma GCC system_header
#endif
#include_next <locale.h>

View File

@ -10,6 +10,8 @@
// is ill-formed (no diagnostic required), per [using.headers]p3, but we permit
// it as an extension.
#include <__config>
extern "C" {
#include <assert.h>
// complex.h is not supported in extern "C".
@ -20,7 +22,9 @@ extern "C" {
#include <inttypes.h>
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <locale.h>
#endif
#include <math.h>
#include <setjmp.h>
#include <signal.h>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-has-no-localization
// <locale.h>
#include <locale.h>

View File

@ -47,7 +47,6 @@
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <compare>
#include <complex>
@ -87,7 +86,6 @@
#include <limits>
#include <limits.h>
#include <list>
#include <locale.h>
#include <map>
#include <math.h>
#include <memory>
@ -138,12 +136,14 @@
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <clocale>
# include <codecvt>
# include <fstream>
# include <iomanip>
# include <ios>
# include <iostream>
# include <istream>
# include <locale.h>
# include <locale>
# include <ostream>
# include <regex>

View File

@ -17,6 +17,8 @@
// RUN: %{cxx} -c -xc %s -fsyntax-only %{flags} %{compile_flags} -std=c99
#include <__config>
#include <complex.h>
#include <ctype.h>
#include <errno.h>
@ -24,7 +26,9 @@
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <locale.h>
#endif
#include <math.h>
#include <setjmp.h>
#include <stdbool.h>

View File

@ -57,8 +57,6 @@ TEST_MACROS();
TEST_MACROS();
#include <climits>
TEST_MACROS();
#include <clocale>
TEST_MACROS();
#include <cmath>
TEST_MACROS();
#include <complex>
@ -127,8 +125,6 @@ TEST_MACROS();
TEST_MACROS();
#include <list>
TEST_MACROS();
#include <locale.h>
TEST_MACROS();
#include <map>
TEST_MACROS();
#include <math.h>
@ -217,6 +213,8 @@ TEST_MACROS();
TEST_MACROS();
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <clocale>
TEST_MACROS();
# include <codecvt>
TEST_MACROS();
# include <fstream>
@ -231,6 +229,8 @@ TEST_MACROS();
TEST_MACROS();
# include <locale>
TEST_MACROS();
# include <locale.h>
TEST_MACROS();
# include <ostream>
TEST_MACROS();
# include <regex>

View File

@ -37,7 +37,6 @@
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <compare>
#include <complex>
@ -76,7 +75,6 @@
#include <limits>
#include <limits.h>
#include <list>
#include <locale.h>
#include <map>
#include <math.h>
#include <memory>
@ -126,6 +124,7 @@
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <clocale>
# include <codecvt>
# include <fstream>
# include <iomanip>
@ -133,6 +132,7 @@
# include <iostream>
# include <istream>
# include <locale>
# include <locale.h>
# include <ostream>
# include <regex>
# include <sstream>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-has-no-localization
// <locale.h>
#include <locale.h>
@ -47,5 +49,5 @@ int main(int, char**)
static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
return 0;
return 0;
}