limits.h fix

Mike Stump mrs@apple.com
Mon Apr 2 21:11:00 GMT 2007


Currently, if a user has their own "limits.h", the:

  #include_next <limits.h>

in syslimits.h can find it, this is wrong.  Instead, we want that file
to find the system limits.h.  The below patch fixes this.

Thanks to Geoff for pointing out the solution...

Ok?

	* gsyslimits.h: Don't include_next <limits.h> here...
	* limitx.h: instead, include_next <limits.h> here.
	* limity.h: Simplify.

Doing diffs in .:
--- ./gsyslimits.h.~1~	2006-11-26 12:31:50.000000000 -0800
+++ ./gsyslimits.h	2007-04-02 12:37:38.000000000 -0700
@@ -4,5 +4,3 @@
    instead of this text.  */
 
 #define _GCC_NEXT_LIMITS_H		/* tell gcc's limits.h to recurse */
-#include_next <limits.h>
-#undef _GCC_NEXT_LIMITS_H
--- ./limitx.h.~1~	2006-11-26 12:31:48.000000000 -0800
+++ ./limitx.h	2007-04-02 13:51:40.000000000 -0700
@@ -1,12 +1,11 @@
 /* This administrivia gets added to the beginning of limits.h
    if the system has its own version of limits.h.  */
 
-/* We use _GCC_LIMITS_H_ because we want this not to match
-   any macros that the system's limits.h uses for its own purposes.  */
-#ifndef _GCC_LIMITS_H_  /* Terminated in limity.h.  */
-#define _GCC_LIMITS_H_
-
 #ifndef _LIBC_LIMITS_H_
 /* Use "..." so that we find syslimits.h only in this same directory.  */
 #include "syslimits.h"
 #endif
+#ifdef _GCC_NEXT_LIMITS_H
+#include_next <limits.h>
+#undef _GCC_NEXT_LIMITS_H
+#endif
--- ./limity.h.~1~	2006-11-26 12:31:49.000000000 -0800
+++ ./limity.h	2007-04-02 12:33:24.000000000 -0700
@@ -1,10 +0,0 @@
-/* This administrivia gets added to the end of limits.h
-   if the system has its own version of limits.h.  */
-
-#else /* not _GCC_LIMITS_H_ */
-
-#ifdef _GCC_NEXT_LIMITS_H
-#include_next <limits.h>		/* recurse down to the real one */
-#endif
-
-#endif /* not _GCC_LIMITS_H_ */
--------------



More information about the Gcc-patches mailing list