diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-10-01 14:34:08 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-15 11:03:32 +0530 |
commit | f338c36269e4a2b87216db22b5bda71279f66a1d (patch) | |
tree | 28bd00d11ced48059342fb8dc50248329f27d221 /posix/confstr.c | |
parent | e4f639e4a106d90c6f3159230788653fd6e40a26 (diff) | |
download | glibc-f338c36269e4a2b87216db22b5bda71279f66a1d.tar.gz glibc-f338c36269e4a2b87216db22b5bda71279f66a1d.tar.xz glibc-f338c36269e4a2b87216db22b5bda71279f66a1d.zip |
Remove Wundef warnings for specification macros
This patch adds a file conf.list that is used to generate macros to determine if a macro is defined as set, unset or not defined. gen-conf.awk processes this file and generates a header (confdefs-defs.h) with these macros. A new header confdefs.h includes this generated header and defines accessor macros for the generated macros. Tested on x86_64. * posix/Makefile (before-compile): Add confdefs-defs.h. ($(objpfx)confdefs-defs.h): New target. * posix/conf.list: New file. * posix/confdefs.h: New file. * posix/confstr.c: Include confdefs.h. (confstr): Use CONF_IS_* macros. * posix/posix-envs.def: Include confdefs.h. Use CONF_IS_* macros. * scripts/gen-conf.awk: New file.
Diffstat (limited to 'posix/confstr.c')
-rw-r--r-- | posix/confstr.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/posix/confstr.c b/posix/confstr.c index a2a1bf2862..1accfeead0 100644 --- a/posix/confstr.c +++ b/posix/confstr.c @@ -21,6 +21,7 @@ #include <string.h> #include <confstr.h> #include "../version.h" +#include "confdefs.h" /* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes of BUF with the value corresponding to NAME and zero-terminate BUF. @@ -100,9 +101,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_ILP32_OFF32_CFLAGS: case _CS_POSIX_V7_ILP32_OFF32_CFLAGS: #ifdef __ILP32_OFF32_CFLAGS -# if _POSIX_V7_ILP32_OFF32 == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFF32) # error "__ILP32_OFF32_CFLAGS should not be defined" -# elif !defined _POSIX_V7_ILP32_OFF32 +# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFF32) if (__sysconf (_SC_V7_ILP32_OFF32) < 0) break; # endif @@ -115,9 +116,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: case _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: #ifdef __ILP32_OFFBIG_CFLAGS -# if _POSIX_V7_ILP32_OFFBIG == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFFBIG) # error "__ILP32_OFFBIG_CFLAGS should not be defined" -# elif !defined _POSIX_V7_ILP32_OFFBIG +# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFFBIG) if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0) break; # endif @@ -130,9 +131,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_LP64_OFF64_CFLAGS: case _CS_POSIX_V7_LP64_OFF64_CFLAGS: #ifdef __LP64_OFF64_CFLAGS -# if _POSIX_V7_LP64_OFF64 == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_LP64_OFF64) # error "__LP64_OFF64_CFLAGS should not be defined" -# elif !defined _POSIX_V7_LP64_OFF64 +# elif CONF_IS_UNDEFINED (_POSIX_V7_LP64_OFF64) if (__sysconf (_SC_V7_LP64_OFF64) < 0) break; # endif @@ -145,9 +146,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: case _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: #ifdef __ILP32_OFF32_LDFLAGS -# if _POSIX_V7_ILP32_OFF32 == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFF32 ) # error "__ILP32_OFF32_LDFLAGS should not be defined" -# elif !defined _POSIX_V7_ILP32_OFF32 +# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFF32) if (__sysconf (_SC_V7_ILP32_OFF32) < 0) break; # endif @@ -160,9 +161,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: case _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: #ifdef __ILP32_OFFBIG_LDFLAGS -# if _POSIX_V7_ILP32_OFFBIG == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFFBIG) # error "__ILP32_OFFBIG_LDFLAGS should not be defined" -# elif !defined _POSIX_V7_ILP32_OFFBIG +# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFFBIG) if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0) break; # endif @@ -175,9 +176,9 @@ confstr (name, buf, len) case _CS_POSIX_V6_LP64_OFF64_LDFLAGS: case _CS_POSIX_V7_LP64_OFF64_LDFLAGS: #ifdef __LP64_OFF64_LDFLAGS -# if _POSIX_V7_LP64_OFF64 == -1 +# if CONF_IS_DEFINED_UNSET (_POSIX_V7_LP64_OFF64) # error "__LP64_OFF64_LDFLAGS should not be defined" -# elif !defined _POSIX_V7_LP64_OFF64 +# elif CONF_IS_UNDEFINED (_POSIX_V7_LP64_OFF64) if (__sysconf (_SC_V7_LP64_OFF64) < 0) break; # endif @@ -188,7 +189,8 @@ confstr (name, buf, len) case _CS_LFS_CFLAGS: case _CS_LFS_LINTFLAGS: -#if _POSIX_V6_ILP32_OFF32 == 1 && _POSIX_V6_ILP32_OFFBIG == 1 +#if (CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFF32) \ + && CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFFBIG)) # define __LFS_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" /* Signal that we want the new ABI. */ string = __LFS_CFLAGS; |