From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id A2D2A3858426; Mon, 29 Jan 2024 17:58:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2D2A3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706551129; bh=3y5zBnJvr6u3f1WytiQ4XO0q6Cri1H91J8smZV8I+48=; h=From:To:Subject:Date:From; b=jS6G/aSWcpU3MnbvBwADdZfuM5uZXZly9GOVkGZxZQ0P9N36mzC2rLxN4yT46xEkS 99HUOSIru7lMV7Ah7jIMNd17ZcPO/n9VJKRPIoTkMjUCthtbJruh2WgjIYORRmW3Xl EZ7mKgPA2c67zk0yv5iGWh3PC45/+NsKmnvI9MTU= 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: 21bc4e0da08511bdf3baedfc28f5360de63d7906 X-Git-Newrev: db6c777dcd9350692f94aa4ab0a6e76917987515 Message-Id: <20240129175849.A2D2A3858426@sourceware.org> Date: Mon, 29 Jan 2024 17:58:49 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=db6c777dcd9350692f94aa4ab0a6e76917987515 commit db6c777dcd9350692f94aa4ab0a6e76917987515 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));