From fd6870aa929cd6c484ffdb2faa4e5fa845c2377d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 24 Oct 2023 18:37:37 -0700 Subject: [PATCH] isnanl-tests, stdio-tests: pacify GCC -Wshadow * tests/test-isnanl.h (NWORDS): Remove. (memory_long_double): Do not redefine in an inner scope. All uses changed to use the snan.h memory_long_double. * tests/test-stdio.c (NWORDS): Remove. (memory_long_double): Do not redefine in an inner scope. The snan.h memory_long_double is fine here. --- ChangeLog | 8 ++++++++ tests/test-isnanl.h | 18 +++++++----------- tests/test-stdio.c | 4 ---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b846a1ca5..8af3088936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2023-10-24 Paul Eggert + isnanl-tests, stdio-tests: pacify GCC -Wshadow + * tests/test-isnanl.h (NWORDS): Remove. + (memory_long_double): Do not redefine in an inner scope. + All uses changed to use the snan.h memory_long_double. + * tests/test-stdio.c (NWORDS): Remove. + (memory_long_double): Do not redefine in an inner scope. + The snan.h memory_long_double is fine here. + explicit_bzero-tests: pacify GCC 13.2.1 * tests/test-explicit_bzero.c: * tests/test-memset_explicit.c: diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index fa7d87b3cd..ee4f2ce02a 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -48,10 +48,6 @@ main () #endif #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE - #define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) - typedef union { unsigned int word[NWORDS]; long double value; } - memory_long_double; /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN @@ -66,39 +62,39 @@ main () # endif { /* Quiet NaN. */ static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; ASSERT (isnanl (x.value)); } { /* Signalling NaN. */ static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; ASSERT (isnanl (x.value)); } /* isnanl should return something for noncanonical values. */ { /* Pseudo-NaN. */ static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; ASSERT (isnanl (x.value) || !isnanl (x.value)); } { /* Pseudo-Infinity. */ static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; ASSERT (isnanl (x.value) || !isnanl (x.value)); } { /* Pseudo-Zero. */ static memory_long_double x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; ASSERT (isnanl (x.value) || !isnanl (x.value)); } { /* Unnormalized number. */ static memory_long_double x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; ASSERT (isnanl (x.value) || !isnanl (x.value)); } { /* Pseudo-Denormal. */ static memory_long_double x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; ASSERT (isnanl (x.value) || !isnanl (x.value)); } #undef NWORDS diff --git a/tests/test-stdio.c b/tests/test-stdio.c index 2836ed18a5..fb3b85a9df 100644 --- a/tests/test-stdio.c +++ b/tests/test-stdio.c @@ -61,10 +61,6 @@ main (void) #if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT /* Check the value of _PRINTF_NAN_LEN_MAX. */ { - #define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) - typedef union { double value; unsigned int word[NWORDS]; } memory_double; - double value1; memory_double value2; char buf[64]; -- 2.11.4.GIT