aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-01-03 14:35:09 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-09 10:29:18 -0300
commit1812de79ab0b4e055773b2d4592e2b80b7a11f7b (patch)
treecf8db221da825cce9450e983a8ddb20eb6ad48dd
parent06bc3f31be54d8ced3cfadba2b0897b038af3fb7 (diff)
downloadglibc-1812de79ab0b4e055773b2d4592e2b80b7a11f7b.tar
glibc-1812de79ab0b4e055773b2d4592e2b80b7a11f7b.tar.gz
glibc-1812de79ab0b4e055773b2d4592e2b80b7a11f7b.tar.bz2
glibc-1812de79ab0b4e055773b2d4592e2b80b7a11f7b.zip
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.
-rw-r--r--stdio-common/vfprintf-internal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c
index 771beca9bf..ba5802cdb9 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)
{