diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-01-03 14:35:09 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-04-17 16:12:40 -0300 |
commit | a31deccd49a258d1fa4f415ede1ea0a1ea9ddc86 (patch) | |
tree | b8576c146caf9ef6c534b861684f791a616939cf /stdio-common | |
parent | d9559c575941030beb9774192a28f4117100c823 (diff) | |
download | glibc-a31deccd49a258d1fa4f415ede1ea0a1ea9ddc86.zip glibc-a31deccd49a258d1fa4f415ede1ea0a1ea9ddc86.tar.gz glibc-a31deccd49a258d1fa4f415ede1ea0a1ea9ddc86.tar.bz2 |
stdio: Fix -Wtautological-constant-out-of-range-compare on clang
clang emits an error while building vfprintf-internal for default
case:
error: result of comparison of constant 255 with expression of type
'char' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
if (spec <= UCHAR_MAX
The test is indeed not required for default non-wide build.
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/vfprintf-internal.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c index 771beca..ba5802c 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1338,7 +1338,12 @@ printf_positional (struct Xprintf_buffer * buf, const CHAR_T *format, /* Process format specifiers. */ do { - if (spec <= UCHAR_MAX +# ifdef COMPILE_WPRINTF +# define CHECK_SPEC(spec) ((spec) <= UCHAR_MAX) +# else +# define CHECK_SPEC(spec) (true) +# endif + if (CHECK_SPEC (spec) && __printf_function_table != NULL && __printf_function_table[(size_t) spec] != NULL) { |