[libcxx-commits] [PATCH] D129862: [libc++][AIX] Correct the definition of __regex_word for AIX

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 16 04:03:42 PDT 2022


xingxue updated this revision to Diff 445223.
xingxue added a comment.

> Can we have a test with a static_assert that checks the bits are disjoint (check union of all flags has the right number of 1s)?

Thanks for catching this, @hubert.reinterpretcast! There is actually an `static_assert` that checks if `regex_word` overlaps other bits but it is disabled for AIX.  This update enables it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129862/new/

https://reviews.llvm.org/D129862

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


Index: libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
===================================================================
--- libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
+++ libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: LIBCXX-AIX-FIXME
-
 // <regex>
 
 // template <class charT> struct regex_traits;
Index: libcxx/test/std/re/re.traits/isctype.pass.cpp
===================================================================
--- libcxx/test/std/re/re.traits/isctype.pass.cpp
+++ libcxx/test/std/re/re.traits/isctype.pass.cpp
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: LIBCXX-AIX-FIXME
-
 // <regex>
 
 // template <class charT> struct regex_traits;
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -492,7 +492,11 @@
     static const mask punct  = _ISPUNCT;
     static const mask xdigit = _ISXDIGIT;
     static const mask blank  = _ISBLANK;
+# if defined(_AIX)
+    static const mask __regex_word = 0x8000;
+# else
     static const mask __regex_word = 0x80;
+# endif
 #elif defined(_NEWLIB_VERSION)
     // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
     typedef char mask;
@@ -545,11 +549,8 @@
 
     _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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129862.445223.patch
Type: text/x-patch
Size: 1846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220716/80dc336b/attachment.bin>


More information about the libcxx-commits mailing list