[libcxx] r283260 - [libcxx] [test] Guard __has_include usage with a macro

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 14:25:53 PDT 2016


Author: ericwf
Date: Tue Oct  4 16:25:51 2016
New Revision: 283260

URL: http://llvm.org/viewvc/llvm-project?rev=283260&view=rev
Log:
[libcxx] [test] Guard __has_include usage with a macro

Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25251

Modified:
    libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/test/support/test_macros.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=283260&r1=283259&r2=283260&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Tue Oct  4 16:25:51 2016
@@ -22,6 +22,12 @@
 #define TEST_HAS_FEATURE(X) 0
 #endif
 
+#ifdef __has_include
+#define TEST_HAS_INCLUDE(X) __has_include(X)
+#else
+#define TEST_HAS_INCLUDE(X) 0
+#endif
+
 #ifdef __has_extension
 #define TEST_HAS_EXTENSION(X) __has_extension(X)
 #else
@@ -63,7 +69,7 @@
 #endif
 
 // Attempt to deduce GCC version
-#if defined(_LIBCPP_VERSION) && __has_include(<features.h>)
+#if defined(_LIBCPP_VERSION) && TEST_HAS_INCLUDE(<features.h>)
 #include <features.h>
 #define TEST_HAS_GLIBC
 #define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)




More information about the cfe-commits mailing list