From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id DC68E3882AC4; Thu, 28 Sep 2023 17:53:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC68E3882AC4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695923614; bh=Tsy+Tza34S39zmA14AbZjVm/Qo0u+hYiL3jEgI2sabw=; h=From:To:Subject:Date:From; b=KXIc/SVRUnMHp4X1OLbuRKo0CcsLnOUpcmU8RL/QYK+HmLzHzediura3kjdibtrli sXQu48GmpxFE6boo3OwekJqHEczMokXVzcDD3xZY5MlF3J2oAH+C+NQ5pZydV9tWc0 E6CWxPqx9JdoXe9K06K3enVZ9NkzBgpKysbun3GY= 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: 985afaf9f55e51d787d79aed7bfc11ed6bc9d63b X-Git-Newrev: 7d3353535f976531d49fc0fe6bbb0a1ec28b6c8f Message-Id: <20230928175334.DC68E3882AC4@sourceware.org> Date: Thu, 28 Sep 2023 17:53:34 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7d3353535f976531d49fc0fe6bbb0a1ec28b6c8f commit 7d3353535f976531d49fc0fe6bbb0a1ec28b6c8f 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));