[libcxx-commits] [PATCH] D91074: [libcxx] check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in __locale
Xiang Xiao via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 9 06:04:17 PST 2020
xiaoxiang781216 created this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
xiaoxiang781216 requested review of this revision.
just like what's done in __locale.cpp
Co-authored-by: Chao An <anchao at xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang at xiaomi.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91074
Files:
libcxx/include/__locale
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -397,7 +397,26 @@
class _LIBCPP_TYPE_VIS ctype_base
{
public:
-#if defined(__GLIBC__)
+#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
+ typedef unsigned long mask;
+ static const mask space = 1<<0;
+ static const mask print = 1<<1;
+ static const mask cntrl = 1<<2;
+ static const mask upper = 1<<3;
+ static const mask lower = 1<<4;
+ static const mask alpha = 1<<5;
+ static const mask digit = 1<<6;
+ static const mask punct = 1<<7;
+ static const mask xdigit = 1<<8;
+ static const mask blank = 1<<9;
+#if defined(__BIONIC__)
+ // Historically this was a part of regex_traits rather than ctype_base. The
+ // historical value of the constant is preserved for ABI compatibility.
+ static const mask __regex_word = 0x8000;
+#else
+ static const mask __regex_word = 1<<10;
+#endif // defined(__BIONIC__)
+#elif defined(__GLIBC__)
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -486,24 +505,7 @@
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
#else
- typedef unsigned long mask;
- static const mask space = 1<<0;
- static const mask print = 1<<1;
- static const mask cntrl = 1<<2;
- static const mask upper = 1<<3;
- static const mask lower = 1<<4;
- static const mask alpha = 1<<5;
- static const mask digit = 1<<6;
- static const mask punct = 1<<7;
- static const mask xdigit = 1<<8;
- static const mask blank = 1<<9;
-#if defined(__BIONIC__)
- // Historically this was a part of regex_traits rather than ctype_base. The
- // historical value of the constant is preserved for ABI compatibility.
- static const mask __regex_word = 0x8000;
-#else
- static const mask __regex_word = 1<<10;
-#endif // defined(__BIONIC__)
+#error unkown classic_table, try _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91074.303851.patch
Type: text/x-patch
Size: 2188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201109/5547d50f/attachment.bin>
More information about the libcxx-commits
mailing list