r289181 - [Headers] Add #include_next for tgmath.h on Darwin
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 8 19:30:47 PST 2016
Author: bruno
Date: Thu Dec 8 21:30:46 2016
New Revision: 289181
URL: http://llvm.org/viewvc/llvm-project?rev=289181&view=rev
Log:
[Headers] Add #include_next for tgmath.h on Darwin
Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.
rdar://problem/19019845
Added:
cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h
cfe/trunk/test/Headers/tgmath-darwin.c
Modified:
cfe/trunk/lib/Headers/tgmath.h
Modified: cfe/trunk/lib/Headers/tgmath.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/tgmath.h?rev=289181&r1=289180&r2=289181&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/tgmath.h (original)
+++ cfe/trunk/lib/Headers/tgmath.h Thu Dec 8 21:30:46 2016
@@ -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 */
Added: cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h?rev=289181&view=auto
==============================================================================
--- cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h (added)
+++ cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h Thu Dec 8 21:30:46 2016
@@ -0,0 +1,4 @@
+#ifndef SYS_TGMATH_H
+#define SYS_TGMATH_H
+
+#endif /* SYS_TGMATH_H */
Added: cfe/trunk/test/Headers/tgmath-darwin.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/tgmath-darwin.c?rev=289181&view=auto
==============================================================================
--- cfe/trunk/test/Headers/tgmath-darwin.c (added)
+++ cfe/trunk/test/Headers/tgmath-darwin.c Thu Dec 8 21:30:46 2016
@@ -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
More information about the cfe-commits
mailing list