]> granicus.if.org Git - clang/commitdiff
Teach tgmath.h to only include <complex.h> if it's available.
authorDouglas Gregor <dgregor@apple.com>
Sun, 29 Jan 2012 23:40:50 +0000 (23:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 29 Jan 2012 23:40:50 +0000 (23:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149213 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/tgmath.h
test/Modules/compiler_builtins.m

index 1b0b9d24c1d52d90d025c8b199a97b32c7ec42dc..554af6cf740bdb9c74823c32d796310948f9e180 100644 (file)
@@ -30,7 +30,9 @@
 
 /* C++ handles type genericity with overloading in math.h. */
 #ifndef __cplusplus
-#include <complex.h>
+#if __has_include(<complex.h>)
+#  include <complex.h>
+#endif
 
 #define _TG_ATTRSp __attribute__((__overloadable__))
 #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
index 5874722c6b85325a19728801578fc3c685e254fa..3545604414aefea2b589b2d04003dcdf7411e763 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t
-// RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t %s
+// RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t %s -Xclang -verify
 
 @import __compiler_builtins.float_constants;
 
@@ -9,4 +9,4 @@ float getFltMax() { return FLT_MAX; }
 
 char getCharMax() { return CHAR_MAX; }
 
-//size_t size; // expected-error{{unknown type name 'size_t'}}
+size_t size; // expected-error{{unknown type name 'size_t'}}