diff options
-rw-r--r-- | clang/lib/Headers/tgmath.h | 9 | ||||
-rw-r--r-- | clang/test/Headers/Inputs/usr/include/tgmath.h | 4 | ||||
-rw-r--r-- | clang/test/Headers/tgmath-darwin.c | 12 |
3 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/Headers/tgmath.h b/clang/lib/Headers/tgmath.h index 318e1185fee..0b8b5ce277c 100644 --- a/clang/lib/Headers/tgmath.h +++ b/clang/lib/Headers/tgmath.h @@ -25,6 +25,14 @@ #ifndef __TGMATH_H #define __TGMATH_H +/* + * Allow additional definitions and implementation-defined values on Apple + * platforms. + */ +#if defined(__APPLE__) && __STDC_HOSTED__ && __has_include_next(<tgmath.h>) +# include_next <tgmath.h> +#else + /* C99 7.22 Type-generic math <tgmath.h>. */ #include <math.h> @@ -1371,4 +1379,5 @@ static long double #undef _TG_ATTRS #endif /* __cplusplus */ +#endif /* __has_include_next */ #endif /* __TGMATH_H */ diff --git a/clang/test/Headers/Inputs/usr/include/tgmath.h b/clang/test/Headers/Inputs/usr/include/tgmath.h new file mode 100644 index 00000000000..897962d9e16 --- /dev/null +++ b/clang/test/Headers/Inputs/usr/include/tgmath.h @@ -0,0 +1,4 @@ +#ifndef SYS_TGMATH_H +#define SYS_TGMATH_H + +#endif /* SYS_TGMATH_H */ diff --git a/clang/test/Headers/tgmath-darwin.c b/clang/test/Headers/tgmath-darwin.c new file mode 100644 index 00000000000..b24b6c0c720 --- /dev/null +++ b/clang/test/Headers/tgmath-darwin.c @@ -0,0 +1,12 @@ +// REQUIRES: system-darwin +// RUN: %clang -target x86_64-apple-darwin10 -fsyntax-only -std=c11 -isysroot %S/Inputs %s +#include <tgmath.h> + +// Test the #include_next on tgmath.h works on Darwin. +#ifndef SYS_TGMATH_H + #error "SYS_TGMATH_H not defined" +#endif + +#ifndef __TGMATH_H + #error "__TGMATH_H not defined" +#endif |