From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 1B0D23858031; Thu, 9 Feb 2023 19:49:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B0D23858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675972175; bh=hdXodwb1xpk+O+yZeHj0ooE13Btg5kF1Mton8kGQlbs=; h=From:To:Subject:Date:From; b=e/8PsLVxGrEvSljwjq6ypkX7FuXGNPU2NJWLnW1z18Zfy5IZnao7EX9/VNuU9xA++ AFnQxOtvuHBA1mnzvWFhl/dHO9GT691HTBuAzF3svDq5gqzrYlzVtgba/jxcyyI/vx FPBXk6OZMCqZER/qF94ptAunyYBNr7+fKpATdH4A= 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: 9d324fdc599f0d1a06155a2b8288942a9ac4f7c0 X-Git-Newrev: 5c94dd0beabfbf5b3c45cffa0a3a4b8d183b0d9c Message-Id: <20230209194935.1B0D23858031@sourceware.org> Date: Thu, 9 Feb 2023 19:49:35 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5c94dd0beabfbf5b3c45cffa0a3a4b8d183b0d9c commit 5c94dd0beabfbf5b3c45cffa0a3a4b8d183b0d9c 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: 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 Diff: --- stdio-common/vfprintf-internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c index c76c06e49b..d3c776790c 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1253,7 +1253,7 @@ printf_positional (struct Xprintf_buffer * buf, const CHAR_T *format, /* Process format specifiers. */ do { - if (spec <= UCHAR_MAX + if ((size_t) spec <= UCHAR_MAX && __printf_function_table != NULL && __printf_function_table[(size_t) spec] != NULL) {