From nobody Sat Feb 03 04:08:13 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TRfJG2LXwz58ySw; Sat, 3 Feb 2024 04:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRfJF6J60z4nhQ; Sat, 3 Feb 2024 04:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706933293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eEcsQc55s2xW9UgXsuMXO+Ozh179328J9Yofqh1BK/g=; b=QPAmnc5qmGRQh2PyrscC57iukKNT+/+/jLPM89HkdY821h5IwkUwzS7URLT9Meyj4rdEE0 6knuZTaTSc2kVBTBJDWj02WVSSfHEMF3liJBUe7uDAYfXgSEJy/wisMj4pAex6K8Vn7UEv 6fFz66HxcXLHro/0EuP1rZ52Nm+C2CP584mDZs0kREKRiOAulvEyC0RsWQrcdQy/+LB8oJ rNiAU25CvLnUoI0sIH44pOwGkRSxreOTvM4IcfZGTePWQpVdarSlW6ABsyWRX9tY+VM6WT V4/Ho1E67u3u8wdqUY5I9zzlQFMphFCgkCy4IVXqnLAmQtrvhSnXktbyRskCjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706933293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eEcsQc55s2xW9UgXsuMXO+Ozh179328J9Yofqh1BK/g=; b=A1Z0EgKR94eSmeFQw49BeD6ga+p8rQzhGhYUYISjC5DXwrYH0AyHqi1qkEcYG+dZhO1d8B FIAj1FB1BfTQEizkgi+WkvPBhjbYaioeulLbsP5sWohi2AWrz6Cs8kl5wt3RNcmCpMpQeS gkXlfIm4QbDkKRrETEnf7L5p8EuZng418xt2lq++as2jsbyrKTf+LMjS7+GMV14jla1jFn frX0EVupOl77HZ2YEFALM+eqQaEdDG0SpixWUabYPe3vP9ZHfQG0NkOkCBC7ihAOKaHmKV n0YIw+WireLaSeNfGe86UspBU8vsecTHwehksIhnmYPXBFdgsxzz+S7RtaXm5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706933293; a=rsa-sha256; cv=none; b=LgM8HqlR689qzgxk+yyWjMu07QGTUvRGUxYqNi6MMKg6ngSDB8pyX27O1jSrvEOU6gUhRB JGKOE3/i+v3cPR4JptJkvrcERKCw3gr83aRUaUgWgY8CTBD9SlIcIMh0SrGGtlw3hMyjYs 6AmurtnVqLHdbdhcEIL5dPzqh46FigwWprtzacGFni904HsKcVuCF9UN7dCOzlmbpJFJUv 9uV+s4TqvCRhAcF3dYhDarxe6A/b58jO9oJlx/r3FlrFFzSZomq6gFFZA32tN6OWPsBtZ5 hUQDhEvysMSSBlUBAyU5aJC87tTS/5mpTaFwYi+csTcYwntSTBQq1folpqrDdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TRfJF5Dd6zyJ6; Sat, 3 Feb 2024 04:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41348Dw2065773; Sat, 3 Feb 2024 04:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41348DJt065770; Sat, 3 Feb 2024 04:08:13 GMT (envelope-from git) Date: Sat, 3 Feb 2024 04:08:13 GMT Message-Id: <202402030408.41348DJt065770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4309f9f2347e - main - include/math.h: fix warning with -Wconversion List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4309f9f2347e05bf995dad89d7c21b0149d35b54 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4309f9f2347e05bf995dad89d7c21b0149d35b54 commit 4309f9f2347e05bf995dad89d7c21b0149d35b54 Author: Martin Oliveira AuthorDate: 2023-09-12 20:31:00 +0000 Commit: Warner Losh CommitDate: 2024-02-03 04:05:49 +0000 include/math.h: fix warning with -Wconversion The way the __fp_type_select macro uses the _Generic expression causes gcc to throw a warning on valid code if the -Wconversion flag is used. For example, consider the following program: #include int main() { double x = 1.0; isnan(x); return 0; } which throws a warning: $ gcc -Wconversion a.c a.c:5:15: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion] 5 | isnan(x); | ^ This happens because the functions are invoked inside of the _Generic. Looking at the example of _Generic in the C11 specification, one sees that the parameters are outside of the _Generic expression (see page 79 here: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf). Reference: https://stackoverflow.com/a/68309379 Signed-off-by: Martin Oliveira Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/841 --- lib/msun/src/math.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index 0e09fca72ea3..5fc359ead158 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -76,9 +76,9 @@ extern const union __nan_un { #if __STDC_VERSION__ >= 201112L || __has_extension(c_generic_selections) #define __fp_type_select(x, f, d, ld) __extension__ _Generic((x), \ - float: f(x), \ - double: d(x), \ - long double: ld(x)) + float: f, \ + double: d, \ + long double: ld)(x) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) #define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(x), long double), ld(x), \