Author: asiri
Date: Mon Oct 10 10:56:01 2016
New Revision: 283762

URL: http://llvm.org/viewvc/llvm-project?rev=283762&view=rev
Log:
[libcxx] Fix gcc build.

Attempt to fix a horrible gcc include order problem.

Modified:
    libcxx/trunk/include/limits.h

Modified: libcxx/trunk/include/limits.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits.h?rev=283762&r1=283761&r2=283762&view=diff
==============================================================================
--- libcxx/trunk/include/limits.h (original)
+++ libcxx/trunk/include/limits.h Mon Oct 10 10:56:01 2016
@@ -44,6 +44,22 @@ Macros:
 #pragma GCC system_header
 #endif
 
+#ifndef __GNUC__
 #include_next <limits.h>
+#else
+// GCC header limits.h recursively includes itself through another header 
called
+// syslimits.h for some reason. This setup breaks down if we directly
+// #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
+// we manually re-create the necessary include sequence below:
+
+// Get the system limits.h defines (force recurse into the next level)
+#define _GCC_LIMITS_H_
+#define _GCC_NEXT_LIMITS_H
+#include_next <limits.h>
+
+// Get the ISO C defines
+#undef _GCC_LIMITS_H_
+#include_next <limits.h>
+#endif // __GNUC__
 
 #endif  // _LIBCPP_LIMITS_H


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to