HomeFreeBSD

Work around bogus old gcc "initializer element is not constant" error

Description

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)

Details

Provenance
dimAuthored on Jun 25 2021, 6:42 PM
Parents
rG7356681c6c28: Fix failures in libm's lround_test after clang 12 import
Branches
Unknown
Tags
Unknown