[libcxx-commits] [libcxx] eb96458 - [libcxx] [Windows] Pick a unique bit for __regex_word

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 31 13:14:09 PST 2022


Author: Martin Storsjö
Date: 2022-01-31T23:13:58+02:00
New Revision: eb9645819c6dde35e2588b2729a847757b5875d3

URL: https://github.com/llvm/llvm-project/commit/eb9645819c6dde35e2588b2729a847757b5875d3
DIFF: https://github.com/llvm/llvm-project/commit/eb9645819c6dde35e2588b2729a847757b5875d3.diff

LOG: [libcxx] [Windows] Pick a unique bit for __regex_word

The old `__regex_word` aliased the mask for `xdigit`, causing stray
test failures.

The diff may look surprising, as if the previous faulty value had
been set specifically for Windows - but this is due to a restructuring
in 411c630bae0e0d50697651797709987e2cfea92d. Prior to that, there
were OS specific settings for some OSes, and one fallback used for
the rest (which turns out to not work for Windows).

Differential Revision: https://reviews.llvm.org/D118188

Added: 
    

Modified: 
    libcxx/include/__locale
    libcxx/test/std/re/re.traits/isctype.pass.cpp
    libcxx/test/std/re/re.traits/lookup_classname.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__locale b/libcxx/include/__locale
index 98445bd2d8f40..51f35eece7121 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -452,7 +452,7 @@ public:
     static const mask punct  = _PUNCT;
     static const mask xdigit = _HEX;
     static const mask blank  = _BLANK;
-    static const mask __regex_word = 0x80;
+    static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
 #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 # ifdef __APPLE__
@@ -545,6 +545,12 @@ public:
     static const mask graph  = alnum | punct;
 
     _LIBCPP_INLINE_VISIBILITY ctype_base() {}
+
+// TODO: Remove the ifndef when the assert no longer fails on AIX.
+#ifndef _AIX
+    static_assert((__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word,
+                  "__regex_word can't overlap other bits");
+#endif
 };
 
 template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;

diff  --git a/libcxx/test/std/re/re.traits/isctype.pass.cpp b/libcxx/test/std/re/re.traits/isctype.pass.cpp
index a044fe2f61d40..df8337a564faa 100644
--- a/libcxx/test/std/re/re.traits/isctype.pass.cpp
+++ b/libcxx/test/std/re/re.traits/isctype.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 
 // <regex>

diff  --git a/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp b/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
index 100cae752a873..3e27d03fe2572 100644
--- a/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
+++ b/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 
 // <regex>


        


More information about the libcxx-commits mailing list