From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 37FAD38582BD; Thu, 21 Dec 2023 18:55:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37FAD38582BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703184922; bh=hl83VKl0kAcnyj8jfd/rI9j1lKCnWhh8QiaM9r+rnCo=; h=From:To:Subject:Date:From; b=Vy+Al10Yvfy9qCm2MJoI3Iu1FKt/SGT7YaNMh8Vx63qOtmC200mnq1ByXfOPnWtgt 6J1ay+oXSSQedDF0RFkROAxOKZA09QM5HYx3saVWv+m68PO4Nzyz201NyqnyAJDidP WIoL6eAxUto80R4tSVJN5PuzynjUK/h35TXKXjlE= 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] math: Fix clang warnings on bug-tgmath1.c X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: c6cafb6d09a395a4a134087dad511c65d8261b75 X-Git-Newrev: 6fe7bf9c6edc443142ccff9dba1bee72628dcd95 Message-Id: <20231221185522.37FAD38582BD@sourceware.org> Date: Thu, 21 Dec 2023 18:55:22 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6fe7bf9c6edc443142ccff9dba1bee72628dcd95 commit 6fe7bf9c6edc443142ccff9dba1bee72628dcd95 Author: Adhemerval Zanella Date: Thu Mar 24 11:08:44 2022 -0300 math: Fix clang warnings on bug-tgmath1.c The type generic fabs expansion issues the floating point absolute with the wrong argument type (for instance cabs with floating point or fabs with a complex type) and clang warns that implicit conversion might incur in unexpected behavior. Diff: --- math/bug-tgmath1.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/math/bug-tgmath1.c b/math/bug-tgmath1.c index 16db9d17a1..1c97df0a40 100644 --- a/math/bug-tgmath1.c +++ b/math/bug-tgmath1.c @@ -1,5 +1,6 @@ #include #include +#include int @@ -29,6 +30,12 @@ main (void) TEST (cimag (1.0f), sizeof (float)); TEST (cimag (1.0f + 1.0fi), sizeof (float)); + /* The type generic fabs expansion issues the floating point absolute with + the wrong argument type (for instance cabs with floating point or fabs + with a complex type) and clang warns that implicit conversion might + incur in unexpected behavior. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wabsolute-value"); TEST (fabs (1.0), sizeof (double)); TEST (fabs (1.0 + 1.0i), sizeof (double)); TEST (fabs (1.0l), sizeof (long double));