aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-10-27 13:02:37 +0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2013-10-27 13:14:22 +0700
commit5017df14dbeadcb486a5b8b95533142ee4296fd1 (patch)
treeddb6330f496b47730557fccb1ca7284befbadfb9
parent14c6628d28648cd069a9e0e519cc69513e3d470b (diff)
Fix an issue with Boost compilation.
The issue is that when these macros are defined, libcxx creates inline functions and so we end up with 2 separate defintions of these functions (one inline in std and one that is extern "C"). We undef these until libcxx is fixed. Without this, some things can fail to compile correctly, like Boost. Fixes issue #1716.
-rw-r--r--system/include/compat/ctype.h17
-rw-r--r--system/include/compat/wchar.h23
-rw-r--r--system/include/compat/wctype.h23
-rw-r--r--tests/test_core.py17
4 files changed, 80 insertions, 0 deletions
diff --git a/system/include/compat/ctype.h b/system/include/compat/ctype.h
index 891006d9..3f504946 100644
--- a/system/include/compat/ctype.h
+++ b/system/include/compat/ctype.h
@@ -14,4 +14,21 @@
#include_next <ctype.h>
+/* We undef these until libcxx is fixed. Without this,
+ some things can fail to compile correctly, like
+ Boost. Issue #1716. */
+
+#undef isalpha
+#undef isblank
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef isctype
+
#endif /* _COMPAT_CTYPE_H_ */
diff --git a/system/include/compat/wchar.h b/system/include/compat/wchar.h
new file mode 100644
index 00000000..42f0bcee
--- /dev/null
+++ b/system/include/compat/wchar.h
@@ -0,0 +1,23 @@
+#ifndef _COMPAT_WCHAR_H_
+#define _COMPAT_WCHAR_H_
+
+#include_next <wchar.h>
+
+/* We undef these until libcxx is fixed. Without this,
+ some things can fail to compile correctly, like
+ Boost. Issue #1716. */
+
+#undef iswalpha
+#undef iswblank
+#undef iswcntrl
+#undef iswdigit
+#undef iswgraph
+#undef iswlower
+#undef iswprint
+#undef iswpunct
+#undef iswspace
+#undef iswupper
+#undef iswxdigit
+#undef iswctype
+
+#endif /* _COMPAT_WCHAR_H_ */
diff --git a/system/include/compat/wctype.h b/system/include/compat/wctype.h
new file mode 100644
index 00000000..0eeaab8b
--- /dev/null
+++ b/system/include/compat/wctype.h
@@ -0,0 +1,23 @@
+#ifndef _COMPAT_WCTYPE_H_
+#define _COMPAT_WCTYPE_H_
+
+#include_next <wctype.h>
+
+/* We undef these until libcxx is fixed. Without this,
+ some things can fail to compile correctly, like
+ Boost. Issue #1716. */
+
+#undef iswalpha
+#undef iswblank
+#undef iswcntrl
+#undef iswdigit
+#undef iswgraph
+#undef iswlower
+#undef iswprint
+#undef iswpunct
+#undef iswspace
+#undef iswupper
+#undef iswxdigit
+#undef iswctype
+
+#endif /* _COMPAT_WCTYPE_H_ */
diff --git a/tests/test_core.py b/tests/test_core.py
index dd5b1e39..b766ac74 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2949,6 +2949,23 @@ Exiting setjmp function, level: 0, prev_jmp: -1
'''
self.do_run(src, '3.14159')
+ def test_iswdigit(self):
+ if self.emcc_args is None: return self.skip('no libcxx inclusion without emcc')
+
+ src = '''
+ #include <stdio.h>
+ #include <cctype>
+ #include <cwctype>
+
+ int main() {
+ using namespace std;
+ printf("%d ", isdigit('0'));
+ printf("%d ", iswdigit(L'0'));
+ return 0;
+ }
+ '''
+ self.do_run(src, '1 1')
+
def test_polymorph(self):
if self.emcc_args is None: return self.skip('requires emcc')
src = '''