aboutsummaryrefslogtreecommitdiff
path: root/posix/confstr.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-12-29 17:37:54 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-12-29 17:37:54 +0530
commit4a6aca7bf8a70f1dc66a07c04aba2d7fd837602d (patch)
tree6f85eb5f9cba191e17cfb74c83d12c19b44a6a7a /posix/confstr.c
parent0025b4cc84a0c1099b11a662acabce2709121be5 (diff)
downloadglibc-4a6aca7bf8a70f1dc66a07c04aba2d7fd837602d.zip
glibc-4a6aca7bf8a70f1dc66a07c04aba2d7fd837602d.tar.gz
glibc-4a6aca7bf8a70f1dc66a07c04aba2d7fd837602d.tar.bz2
Remove Wundef warnings for specification macros
This patch adds a file posix-conf-vars.list that is used to generate macros to determine if a macro is defined as set, unset or not defined. gen-posix-conf-vars.awk processes this file and generates a header (posix-conf-vars-def.h) with these macros. A new header posix-conf-vars.h includes this generated header and defines accessor macros for the generated macros. Tested on x86_64. * posix/Makefile (before-compile): Add posix-conf-vars-def.h. ($(objpfx)posix-conf-vars-def.h): New target. * posix/posix-conf-vars.list: New file. * posix/posix-conf-vars.h: New file. * posix/confstr.c: Include posix-conf-vars.h. (confstr): Use CONF_IS_* macros. * posix/posix-envs.def: Include posix-conf-vars.h. Use CONF_IS_* macros. * scripts/gen-posix-conf-vars.awk: New file.
Diffstat (limited to 'posix/confstr.c')
-rw-r--r--posix/confstr.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/posix/confstr.c b/posix/confstr.c
index a2a1bf2..e4e0f4b 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <confstr.h>
#include "../version.h"
+#include <posix-conf-vars.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;