On my linux system, limits.h #include_nexts limits.h again, trying to get the GCC one.
So this is what happens with clang's limits.h

#include <limits.h>
->  clang's limits.h
  -> #include_next <limits.h>
     -> system's limits.h
        -> #include_next <limits.h>
            -> error: 'limits.h' file not found

Attached is a possible fix, for your reviewing pleasure.

-Argiris


Index: test/Preprocessor/clang_headers.c
===================================================================
--- test/Preprocessor/clang_headers.c	(revision 0)
+++ test/Preprocessor/clang_headers.c	(revision 0)
@@ -0,0 +1,4 @@
+// RUN: clang -E %s
+
+#include <limits.h>
+
Index: lib/Headers/limits.h
===================================================================
--- lib/Headers/limits.h	(revision 64397)
+++ lib/Headers/limits.h	(working copy)
@@ -25,6 +25,12 @@
 #ifndef __LIMITS_H
 #define __LIMITS_H
 
+/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.
+ * Avert this #include_next madness. */
+#if defined __GNUC__ && !defined _GCC_LIMITS_H_
+#define _GCC_LIMITS_H_
+#endif
+
 /* System headers include a number of constants from POSIX in <limits.h>. */
 #include_next <limits.h>
 
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to