From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 996883858408; Wed, 7 Feb 2024 14:06:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 996883858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707314818; bh=fHE9mNqNwNyofGZMQFKJPzF1juvyTma+p5OvFNKra2o=; h=From:To:Subject:Date:From; b=Y8xCggSCaagr+Ji4f0qKgthG7J9xADuCzGqCQTiC+vRlKE4sEnOGqpTuOjdaw/dyN YCEmQoJXfV+q0WEE6eOk95uGxHdlWGUbRD8jKnbP+v3bqthGqZoyl32gVETFHqfbLG p6gC8o7N+MXO8y9oRuHQIDupaeoA75Nl+Vl1e954= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] stdio: Fix -Wtautological-constant-out-of-range-compare on clang X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 825f038613100f6abbfb7b2b88803cc67280ffaf X-Git-Newrev: 06c99e6273648fbec260bf9bb620547db90f445a Message-Id: <20240207140658.996883858408@sourceware.org> Date: Wed, 7 Feb 2024 14:06:58 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=06c99e6273648fbec260bf9bb620547db90f445a commit 06c99e6273648fbec260bf9bb620547db90f445a Author: Adhemerval Zanella Date: Tue Jan 3 14:35:09 2023 -0300 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. Diff: --- stdio-common/vfprintf-internal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) {