From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 10FDC385703F; Wed, 30 Aug 2023 12:37:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10FDC385703F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693399060; bh=fMR4iOHBPFA7YYKK13vSuQp2iYmK5YlydcsVfqQxAqI=; h=From:To:Subject:Date:From; b=IP54egg8MgZpRQ78x8cQpxHU4pmnZBbY63LNxaNuymygUqGKyBSifVtRsboVmOuVY D5ZHNswvV2nMBKXwnDhYr2vjIRjZfqnMUwB46oqKzr1mbTeLWo52RO3TPNi4PtuqwN 8kURSGtcJWJ/gPMHKzijYYfSa3c98rGkNS6UE0js= 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: 728cb09976a8b45c610a5535313943bf552b8016 X-Git-Newrev: f7ae5fec8f47b2ffeb2840723e4d05e2881cd952 Message-Id: <20230830123740.10FDC385703F@sourceware.org> Date: Wed, 30 Aug 2023 12:37:40 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f7ae5fec8f47b2ffeb2840723e4d05e2881cd952 commit f7ae5fec8f47b2ffeb2840723e4d05e2881cd952 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 6d6d96e800..dd9203f6d7 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1338,7 +1338,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) {