[cfe-commits] r64408 - in /cfe/trunk: lib/Headers/limits.h test/Preprocessor/clang_headers.c

Howard Hinnant hhinnant at apple.com
Thu Feb 12 15:11:54 PST 2009


I note that you meant __CLANG instead of CLANG (good).  If it matters  
to anyone, _CLANG (one leading underscore) would also be safe.  I tend  
to minimize my use of leading underscores as much as possible. :-)

-Howard

On Feb 12, 2009, at 6:06 PM, Mike Stump wrote:

> Author: mrs
> Date: Thu Feb 12 17:06:31 2009
> New Revision: 64408
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64408&view=rev
> Log:
> Fix limits.h for linux, as glibc does a #include_next unless
> _GCC_LIMITS_H_ is defined, when __GNUC__ is defined.
>
> Also, we need to stay away from possible conflicts with header guards.
> We should use CLANG_ to prefix all header guards.
>
> Added:
>    cfe/trunk/test/Preprocessor/clang_headers.c
> Modified:
>    cfe/trunk/lib/Headers/limits.h
>
> Modified: cfe/trunk/lib/Headers/limits.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/limits.h?rev=64408&r1=64407&r2=64408&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Headers/limits.h (original)
> +++ cfe/trunk/lib/Headers/limits.h Thu Feb 12 17:06:31 2009
> @@ -22,8 +22,14 @@
>  *
> \*= 
> = 
> = 
> ----------------------------------------------------------------------= 
> ==*/
>
> -#ifndef __LIMITS_H
> -#define __LIMITS_H
> +#ifndef __CLANG_LIMITS_H
> +#define __CLANG_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>
> @@ -90,4 +96,4 @@
> #define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
> #endif
>
> -#endif /* __LIMITS_H */
> +#endif /* __CLANG_LIMITS_H */
>
> Added: cfe/trunk/test/Preprocessor/clang_headers.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/clang_headers.c?rev=64408&view=auto
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/test/Preprocessor/clang_headers.c (added)
> +++ cfe/trunk/test/Preprocessor/clang_headers.c Thu Feb 12 17:06:31  
> 2009
> @@ -0,0 +1,3 @@
> +// RUN: clang -E %s
> +
> +#include <limits.h>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list