From 8101c7f8a9b9494014db5da9f88b50e69f90acf4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 29 Jan 2012 23:40:50 +0000 Subject: [PATCH] Teach tgmath.h to only include if it's available. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149213 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/tgmath.h | 4 +++- test/Modules/compiler_builtins.m | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Headers/tgmath.h b/lib/Headers/tgmath.h index 1b0b9d24c1..554af6cf74 100644 --- a/lib/Headers/tgmath.h +++ b/lib/Headers/tgmath.h @@ -30,7 +30,9 @@ /* C++ handles type genericity with overloading in math.h. */ #ifndef __cplusplus -#include +#if __has_include() +# include +#endif #define _TG_ATTRSp __attribute__((__overloadable__)) #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__)) diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m index 5874722c6b..3545604414 100644 --- a/test/Modules/compiler_builtins.m +++ b/test/Modules/compiler_builtins.m @@ -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'}} -- 2.40.0