summaryrefslogtreecommitdiffstats
path: root/lib/Headers
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2017-03-16 23:19:00 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2017-03-16 23:19:00 +0000
commit4d6eb59efd5dfda74bf2ddd78da9497055bb339f (patch)
treea1bcc4265b056ae0c577c144f882dcf1c638c043 /lib/Headers
parent6113c885c45be5c67f665a06983b1b8e021d53e2 (diff)
[Headers] Reapply: Add #include_next for tgmath.h on Darwin
Reapply r289181 but rename the include guard to avoid conflict with the one from Darwin. Allow darwin to provide additional definitions and implementation specifc values for tgmath.h on Apple platforms. rdar://problem/19019845 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Headers')
-rw-r--r--lib/Headers/tgmath.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Headers/tgmath.h b/lib/Headers/tgmath.h
index 318e1185fe..34e26dcc05 100644
--- a/lib/Headers/tgmath.h
+++ b/lib/Headers/tgmath.h
@@ -22,12 +22,21 @@
*
\*===----------------------------------------------------------------------===*/
-#ifndef __TGMATH_H
-#define __TGMATH_H
+#ifndef __CLANG_TGMATH_H
+#define __CLANG_TGMATH_H
/* C99 7.22 Type-generic math <tgmath.h>. */
#include <math.h>
+/*
+ * Allow additional definitions and implementation-defined values on Apple
+ * platforms. This is done after #include <math.h> to avoid depcycle conflicts
+ * between libcxx and darwin in C++ modules builds.
+ */
+#if defined(__APPLE__) && __STDC_HOSTED__ && __has_include_next(<tgmath.h>)
+# include_next <tgmath.h>
+#else
+
/* C++ handles type genericity with overloading in math.h. */
#ifndef __cplusplus
#include <complex.h>
@@ -1371,4 +1380,5 @@ static long double
#undef _TG_ATTRS
#endif /* __cplusplus */
-#endif /* __TGMATH_H */
+#endif /* __has_include_next */
+#endif /* __CLANG_TGMATH_H */