From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 6CE813858416; Fri, 9 Feb 2024 17:33:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CE813858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707499997; bh=cQKMVDvZewf7dDt6mXSDvZ15IzRtO0ScUScaho7F/s8=; h=From:To:Subject:Date:From; b=Bmz1vVQNQmwvrG23ugYNL9ex4PfUJx3+/HDxMHPrfogkcjjKYBiO9mAF1wAtX7PjY tLeb3OBzuEmyBDJezCw9hygyWqPJecP8VFqR0Woq+AVCE/NuPl5G/6E1pryMrDPYJF XeRvetPMjDKf0Qva/i6Wf6MEd6T1xWtf609PvtLI= 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: 9491140bd7c32a24e8620d4b00fe42537eb23338 X-Git-Newrev: 8135781ced0959951eacde8d5ab184fafb46ca6a Message-Id: <20240209173317.6CE813858416@sourceware.org> Date: Fri, 9 Feb 2024 17:33:17 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8135781ced0959951eacde8d5ab184fafb46ca6a commit 8135781ced0959951eacde8d5ab184fafb46ca6a 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));