From owner-dev-commits-src-all@freebsd.org Fri Jun 25 18:46:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16325641393; Fri, 25 Jun 2021 18:46:26 +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 4GBQvQ07rmz3Bsm; Fri, 25 Jun 2021 18:46:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E151710975; Fri, 25 Jun 2021 18:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15PIkPmm093411; Fri, 25 Jun 2021 18:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PIkPv4093410; Fri, 25 Jun 2021 18:46:25 GMT (envelope-from git) Date: Fri, 25 Jun 2021 18:46:25 GMT Message-Id: <202106251846.15PIkPv4093410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 97358891aa6a - stable/12 - Work around bogus old gcc "initializer element is not constant" error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 97358891aa6aa5101bc3b0a673157538a0212e35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 18:46:26 -0000 The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=97358891aa6aa5101bc3b0a673157538a0212e35 commit 97358891aa6aa5101bc3b0a673157538a0212e35 Author: Dimitry Andric AuthorDate: 2021-06-25 18:42:38 +0000 Commit: Dimitry Andric CommitDate: 2021-06-25 18:46:02 +0000 Work around bogus old gcc "initializer element is not constant" error After df3b437c1e073eb83e9a93af1c417f3ee8d0de3b, older gcc's such as 4.2.1 (still used on earlier branches for e.g. mips and powerpc) and 6.3.0 (still used for some cross-builds) started throwing bogus errors like: In file included from /workspace/src/lib/msun/src/s_llround.c:11:0: /workspace/src/lib/msun/src/s_lround.c:54:31: error: initializer element is not constant static const type dtype_min = type_min - 0.5; ^~~~~~~~ /workspace/src/lib/msun/src/s_lround.c:55:31: error: initializer element is not constant static const type dtype_max = type_max + 0.5; ^~~~~~~~ Since 'type_min' and 'type_max' are constants declared just above these lines this error is nonsensical, but older gcc's are not smart enough. Work around the error by reusing the (type)DTYPE_MIN and (type)DTYPE_MAX macros, so I can MFC this right away, unbreaking a few stable builds. (cherry picked from commit 0bcd49c13ada1461bcea85e0466811ddcb290b5e) --- lib/msun/src/s_lround.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msun/src/s_lround.c b/lib/msun/src/s_lround.c index c4d305401ac8..1dd8e697f703 100644 --- a/lib/msun/src/s_lround.c +++ b/lib/msun/src/s_lround.c @@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$"); */ static const type type_min = (type)DTYPE_MIN; static const type type_max = (type)DTYPE_MAX; -static const type dtype_min = type_min - 0.5; -static const type dtype_max = type_max + 0.5; +static const type dtype_min = (type)DTYPE_MIN - 0.5; +static const type dtype_max = (type)DTYPE_MAX + 0.5; #define INRANGE(x) (dtype_max - type_max != 0.5 || \ ((x) > dtype_min && (x) < dtype_max))