From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 89B92385829A; Wed, 7 Feb 2024 14:08:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89B92385829A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707314916; bh=/kBMQ3SDoT3/ZtYJyXyA/vgiSrHMn6ogHeF154cJRoQ=; h=From:To:Subject:Date:From; b=X4bO8ZcbYGEzCo8uNcFFl9aRXgaflDpCX/dKToIn8EIPzM3jjYCw10n6Cu8LsMA2v vWQeRLAYgZmMQbU+R52z4ARXUHxRoMBWRdaAKEJtaLSrxApCUpZNi/z5xq51l7FwqF IofNuPlUw6TWuSJhg65WGo3Q51EhsL/8Ka3CQUGs= 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: 52abd5ca02a7c68629913649c7db2af5742822c3 X-Git-Newrev: 5651ad7af72230de7767212da5831c9d06896202 Message-Id: <20240207140836.89B92385829A@sourceware.org> Date: Wed, 7 Feb 2024 14:08:36 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5651ad7af72230de7767212da5831c9d06896202 commit 5651ad7af72230de7767212da5831c9d06896202 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));