[libcxx-commits] [libcxx] 675401e - [libcxx] Avoid pulling in xlocinfo.h in public headers
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 24 14:32:43 PDT 2021
Author: Martin Storsjö
Date: 2021-03-24T23:29:59+02:00
New Revision: 675401e04c0687693c3b869410ed575387e7d8d6
URL: https://github.com/llvm/llvm-project/commit/675401e04c0687693c3b869410ed575387e7d8d6
DIFF: https://github.com/llvm/llvm-project/commit/675401e04c0687693c3b869410ed575387e7d8d6.diff
LOG: [libcxx] Avoid pulling in xlocinfo.h in public headers
Including xlocinfo.h is a bit of a layering violation; locale.h is
the C library header we should use, while xlocinfo.h is essentially
part of the MS C++ library. Including xlocinfo.h brings in yvals.h,
which brings in yvals_core.h, which defines the MS STL's version
support macros, overriding what libc++'s <version> had defined.
Instead just include locale.h, and provide the few defines we need
for locale categories manually.
Differential Revision: https://reviews.llvm.org/D99213
Added:
Modified:
libcxx/include/__support/win32/locale_win32.h
libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__support/win32/locale_win32.h b/libcxx/include/__support/win32/locale_win32.h
index d32a7a8ad304..3c5c87ae592d 100644
--- a/libcxx/include/__support/win32/locale_win32.h
+++ b/libcxx/include/__support/win32/locale_win32.h
@@ -12,9 +12,28 @@
#include <__config>
#include <stdio.h>
-#include <xlocinfo.h> // _locale_t
+#include <locale.h> // _locale_t
#include <__nullptr>
+#define _X_ALL LC_ALL
+#define _X_COLLATE LC_COLLATE
+#define _X_CTYPE LC_CTYPE
+#define _X_MONETARY LC_MONETARY
+#define _X_NUMERIC LC_NUMERIC
+#define _X_TIME LC_TIME
+#define _X_MAX LC_MAX
+#define _X_MESSAGES 6
+#define _NCAT (_X_MESSAGES + 1)
+
+#define _CATMASK(n) ((1 << (n)) >> 1)
+#define _M_COLLATE _CATMASK(_X_COLLATE)
+#define _M_CTYPE _CATMASK(_X_CTYPE)
+#define _M_MONETARY _CATMASK(_X_MONETARY)
+#define _M_NUMERIC _CATMASK(_X_NUMERIC)
+#define _M_TIME _CATMASK(_X_TIME)
+#define _M_MESSAGES _CATMASK(_X_MESSAGES)
+#define _M_ALL (_CATMASK(_NCAT) - 1)
+
#define LC_COLLATE_MASK _M_COLLATE
#define LC_CTYPE_MASK _M_CTYPE
#define LC_MONETARY_MASK _M_MONETARY
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
index a590f429fb00..c48a1894eada 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
@@ -13,8 +13,6 @@
// <complex>
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
// Test the feature test macros defined by <complex>
/* Constant Value
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
index d28fa4cecda6..c361569cb1d6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
@@ -12,7 +12,6 @@
// clang-format off
// UNSUPPORTED: libcpp-has-no-filesystem-library
-// XFAIL: LIBCXX-WINDOWS-FIXME
// <filesystem>
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
index 1c0d3255d13d..9ea01ebe06df 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
@@ -12,7 +12,6 @@
// clang-format off
// UNSUPPORTED: libcpp-has-no-localization
-// XFAIL: LIBCXX-WINDOWS-FIXME
// <istream>
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
index 20065fe19acb..f9620763c762 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
@@ -12,7 +12,6 @@
// clang-format off
// UNSUPPORTED: libcpp-has-no-localization
-// XFAIL: LIBCXX-WINDOWS-FIXME
// <locale>
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
index 6b729bc09eb0..586cd8ec6d57 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
@@ -12,7 +12,6 @@
// clang-format off
// UNSUPPORTED: libcpp-has-no-localization
-// XFAIL: LIBCXX-WINDOWS-FIXME
// <ostream>
More information about the libcxx-commits
mailing list