From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id D8D20385840C; Tue, 4 Oct 2022 12:56:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8D20385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664888198; bh=A885wjdVCtXASZAGWhWxYuYPOC0RGVUt85hfA31x554=; h=From:To:Subject:Date:From; b=Ug2Fg80ozdiwuTe+cYAazqicJS1R82cNE87uL+bSeGRrwdM8KJgxiibic5Nem7qB0 ftLQiEhD1rd51ats4lL0ke0eWGEWfT31nFkEiDtWjphJYJ6TLDXLPyvQelkBmSEEvM mYs7oGRbdy27BmRr/DSzKwEyRenaf53zW3L2s2Ms= 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: e91e031633d70d197f1c32f54d58821964f7940b X-Git-Newrev: c6e5b8af3e28649b338834c0890672cdd73a09d4 Message-Id: <20221004125638.D8D20385840C@sourceware.org> Date: Tue, 4 Oct 2022 12:56:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c6e5b8af3e28649b338834c0890672cdd73a09d4 commit c6e5b8af3e28649b338834c0890672cdd73a09d4 Author: Adhemerval Zanella Date: Wed Mar 9 15:57:17 2022 -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 fb94961f37..ccbca28fd0 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1380,7 +1380,7 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format, { int function_done; - if (spec <= UCHAR_MAX + if ((int) spec <= UCHAR_MAX && __printf_function_table != NULL && __printf_function_table[(size_t) spec] != NULL) {