From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 5F6153889E3A; Fri, 28 Oct 2022 17:40:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F6153889E3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666978844; bh=n4YjDOBGrGV91+oUMQoenxZpagI7C2u22KDIYoyeeEw=; h=From:To:Subject:Date:From; b=LciF5LWF7zh9La5onBIbQZC4xc9mbNH/71NNyEK7jfnFA3k0D0usAOQ36H22f+viF EbxREvXUIEZyb5sIWuV+QjRGGkT0DnLe6Qhmde9+clTOLZbq/WJ/r9SdsgDYC8kP64 a2KcOFpueb3hjCqnPlFwAmvMWFBTsrEILUUWaROM= 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: Suppress clang warning on math_check_force_underflow X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: aa1f383b69c4262ce992a85f88fbbd1beb4b9759 X-Git-Newrev: 4685f533a2c76640ca6e96f0b3c60fea1ad94efc Message-Id: <20221028174044.5F6153889E3A@sourceware.org> Date: Fri, 28 Oct 2022 17:40:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4685f533a2c76640ca6e96f0b3c60fea1ad94efc commit 4685f533a2c76640ca6e96f0b3c60fea1ad94efc Author: Adhemerval Zanella Date: Thu Mar 10 13:53:13 2022 -0300 math: Suppress clang warning on math_check_force_underflow Clang warns: ../sysdeps/x86/fpu/powl_helper.c:233:3: error: absolute value function '__builtin_fabsf' given an argument of type 'typeof (res)' (aka 'long double') but has parameter of type 'float' which may cause truncation of value [-Werror,-Wabsolute-value] math_check_force_underflow (res); ^ ./math-underflow.h:45:11: note: expanded from macro 'math_check_force_underflow' if (fabs_tg (force_underflow_tmp) \ ^ ./math-underflow.h:27:20: note: expanded from macro 'fabs_tg' #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x)) ^ ../math/math.h:899:16: note: expanded from macro '__MATH_TG' float: FUNC ## f ARGS, \ ^ :73:1: note: expanded from here __builtin_fabsf ^ Diff: --- math/math-underflow.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/math/math-underflow.h b/math/math-underflow.h index c9d363ddd1..4bec3d349e 100644 --- a/math/math-underflow.h +++ b/math/math-underflow.h @@ -23,6 +23,7 @@ #include #include +#include #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x)) @@ -37,10 +38,15 @@ #define min_of_type(x) __MATH_TG ((x), (__typeof (x)) min_of_type_, ()) /* If X (which is not a NaN) is subnormal, force an underflow - exception. */ + exception. + + clang issues a warning where _Generic is using a non expected + builtin which may cause truncation of value. */ #define math_check_force_underflow(x) \ do \ { \ + DIAG_PUSH_NEEDS_COMMENT_CLANG; \ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wabsolute-value"); \ __typeof (x) force_underflow_tmp = (x); \ if (fabs_tg (force_underflow_tmp) \ < min_of_type (force_underflow_tmp)) \ @@ -49,6 +55,7 @@ = force_underflow_tmp * force_underflow_tmp; \ math_force_eval (force_underflow_tmp2); \ } \ + DIAG_POP_NEEDS_COMMENT_CLANG; \ } \ while (0) /* Likewise, but X is also known to be nonnegative. */