[PATCH] D16639: [libcxx] Limit catopen usage to unix-like OSes
Ben Craig via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 10:37:43 PST 2016
bcraig created this revision.
bcraig added reviewers: mclow.lists, ed, jfb, EricWF, jroelofs.
bcraig added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer, jfb.
Operating systems that are not unix-like are unlikely to have access to catopen. Instead of black-listing each one, we now filter out all non-unix operating systems first. We then exclude the unix-like operating systems that don't have catopen. _WIN32 counts as a unix-like operating system because of cygwin.
The catopen existence check was moved form __config to locale because locale is the only user of this information.
http://reviews.llvm.org/D16639
Files:
include/__config
include/locale
Index: include/locale
===================================================================
--- include/locale
+++ include/locale
@@ -199,6 +199,15 @@
// has had a chance to bake for a bit
#include <support/newlib/xlocale.h>
#endif
+
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+// Most unix variants have catopen. These are the specific ones that don't.
+#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
+ !defined(__CloudABI__)
+#define _LIBCPP_HAS_CATOPEN 1
+#endif
+#endif
+
#ifdef _LIBCPP_HAS_CATOPEN
#include <nl_types.h>
#endif
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -713,11 +713,6 @@
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
-#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
- !defined(__CloudABI__)
-#define _LIBCPP_HAS_CATOPEN 1
-#endif
-
#ifdef __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16639.46150.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160127/606cc07a/attachment.bin>
More information about the cfe-commits
mailing list