C standard library: standard headers may reserve non-standard identifiers which don't begin with an underscore

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Nov 4 12:40:01 GMT 2021


On Nov  4 00:23, Pavel M via Cygwin wrote:
> Observation: C standard library: standard headers may reserve non-standard
> identifiers which don't begin with an underscore.
> 
> Invocations:
> $ echo -e "#include <limits.h>\n#define NL_NMAX" | gcc -xc - -std=c11
> -pedantic -Wall -Wextra -E > /dev/null
> <stdin>:2: warning: "NL_NMAX" redefined
> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:203,
>                  from
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/syslimits.h:7,
>                  from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:34,
>                  from <stdin>:1:
> /usr/include/limits.h:507: note: this is the location of the previous
> definition
>   507 | #define NL_NMAX                              INT_MAX
> 
> $ echo -e "#include <limits.h>\n#define PAGESIZE" | gcc -xc - -std=c11
> -pedantic -Wall -Wextra -E > /dev/null
> <stdin>:2: warning: "PAGESIZE" redefined
> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:203,
>                  from
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/syslimits.h:7,
>                  from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:34,
>                  from <stdin>:1:
> /usr/include/limits.h:220: note: this is the location of the previous
> definition
>   220 | #define PAGESIZE __PAGESIZE
> 
> # and so on...

That's ok for limits.h, see
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

Some of the values also use feature test macros.


Corinna


More information about the Cygwin mailing list