diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-03-09 18:22:46 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-08-30 08:40:47 -0300 |
commit | ddcf5a9170a0db5055259118f3090debab248126 (patch) | |
tree | 296a306e3904e8aa8e4eb7c8475683e89576cf95 /sysdeps/posix | |
parent | 6c4ee1aba17f1e71b9ec856479260de9d362fdb6 (diff) | |
download | glibc-ddcf5a9170a0db5055259118f3090debab248126.zip glibc-ddcf5a9170a0db5055259118f3090debab248126.tar.gz glibc-ddcf5a9170a0db5055259118f3090debab248126.tar.bz2 |
posix: Fix macro expansion producing 'defined' has undefined behavior
The NEED_CHECK_SPEC is defined as:
#define NEED_CHECK_SPEC \
(!defined _XBS5_ILP32_OFF32 || !defined _XBS5_ILP32_OFFBIG \
|| !defined _XBS5_LP64_OFF64 || !defined _XBS5_LPBIG_OFFBIG \
|| !defined _POSIX_V6_ILP32_OFF32 || !defined _POSIX_V6_ILP32_OFFBIG \
|| !defined _POSIX_V6_LP64_OFF64 || !defined _POSIX_V6_LPBIG_OFFBIG \
|| !defined _POSIX_V7_ILP32_OFF32 || !defined _POSIX_V7_ILP32_OFFBIG \
|| !defined _POSIX_V7_LP64_OFF64 || !defined _POSIX_V7_LPBIG_OFFBIG)
Which is undefined behavior accordingly to C Standard (Preprocessing
directives, p4).
Checked on x86_64-linux-gnu.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/sysconf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index f760bf4..c29b70a 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -37,13 +37,17 @@ #define NEED_SPEC_ARRAY 0 #include <posix-conf-vars.h> -#define NEED_CHECK_SPEC \ - (!defined _XBS5_ILP32_OFF32 || !defined _XBS5_ILP32_OFFBIG \ +#if !defined _XBS5_ILP32_OFF32 || !defined _XBS5_ILP32_OFFBIG \ || !defined _XBS5_LP64_OFF64 || !defined _XBS5_LPBIG_OFFBIG \ || !defined _POSIX_V6_ILP32_OFF32 || !defined _POSIX_V6_ILP32_OFFBIG \ || !defined _POSIX_V6_LP64_OFF64 || !defined _POSIX_V6_LPBIG_OFFBIG \ || !defined _POSIX_V7_ILP32_OFF32 || !defined _POSIX_V7_ILP32_OFFBIG \ - || !defined _POSIX_V7_LP64_OFF64 || !defined _POSIX_V7_LPBIG_OFFBIG) + || !defined _POSIX_V7_LP64_OFF64 || !defined _POSIX_V7_LPBIG_OFFBIG +# define NEED_CHECK_SPEC 1 +#else +# define NEED_CHECK_SPEC 0 +#endif + #if NEED_CHECK_SPEC static long int __sysconf_check_spec (const char *spec); #endif |