https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105435
Bug ID: 105435
Summary: Wtautological-constant-compare warning in trunk build
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
I just had a go at a clang-based build of gcc trunk
on arm, specifically Raspberry PI 3.
clang said:
trunk/gcc/config/arm/arm-c.cc:299:7: warning: converting the result of '?:'
with integer constants to a boolean always evaluates to 'true'
[-Wtautological-constant-compare]
Source code is
if (TARGET_ARM_FP)
and
/* Set as a bit mask indicating the available widths of hardware floating
point types. Where bit 1 indicates 16-bit support, bit 2 indicates
32-bit support, bit 3 indicates 64-bit support. */
#define TARGET_ARM_FP \
(!TARGET_SOFT_FLOAT ? (TARGET_VFP_SINGLE ? 4 \
: (TARGET_VFP_DOUBLE ? (TARGET_FP16 ? 14 : 12) : 0)) \
: 0)
Four ternary operators in one expression is a complex expression
and it looks like clang can find fault with it.
I hope there is a simpler way to write the code that hopefully
removes the clang warning.