[libcxx] r261088 - [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems
Daniel Sanders via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 17 05:16:31 PST 2016
Author: dsanders
Date: Wed Feb 17 07:16:31 2016
New Revision: 261088
URL: http://llvm.org/viewvc/llvm-project?rev=261088&view=rev
Log:
[libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems
Summary:
On glibc, the bits used for the various character classes is endian dependant
(see _ISbit() in ctypes.h) but __regex_word does not account for this and uses
a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the
bit for graphic characters which causes '-', '@', etc. to be considered a word
character.
Fixed this by defining the value using _ISbit(15) on MIPS glibc systems. We've
restricted this to MIPS for now to avoid the risk of introducing failures in
other targets.
Fixes PR26476.
Reviewers: hans, mclow.lists
Subscribers: dsanders, cfe-commits
Differential Revision: http://reviews.llvm.org/D17132
Modified:
libcxx/trunk/include/regex
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=261088&r1=261087&r2=261088&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed Feb 17 07:16:31 2016
@@ -976,7 +976,12 @@ public:
typedef locale locale_type;
typedef ctype_base::mask char_class_type;
+#if defined(__mips__) && defined(__GLIBC__)
+ static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
+#else
static const char_class_type __regex_word = 0x80;
+#endif
+
private:
locale __loc_;
const ctype<char_type>* __ct_;
More information about the cfe-commits
mailing list