Open pmor13 opened 2 years ago
The __STDC_IEC_559__
is defined to 1
in glibc-2.25/include/stdc-predef.h
, while it is expected to be defined by the compiler itself. Since clang does not define __GCC_IEC_559
, then __STDC_IEC_559__
is (unexpectedly) defined to 1
by stdc-predef.h
.
As a result: under -ffp-model=fast
(behaves identically to specifying both -ffast-math
and -ffp-contract=fast
) AND if stdc-predef.h
is included (as a part of #include <standard_header>
), then it is unclear, for which purpose the __STDC_IEC_559__
is defined to 1
.
Possible solution: implement gcc's behavior regarding __GCC_IEC_559
.
In contrast with GCC Clang does not preinclude stdc-predef.h
.
Hence, Clang violates C11, 6.10.8 Predefined macro names:
None of these macro names, nor the identifier defined, shall be the subject of a
define or a #undef preprocessing directive.
Extra: to remind:
The values of the predefined macros listed in the following subclauses176) (except for _ FILE and LINE _) remain constant throughout the translation unit.
Overall: Clang needs to preinclude stdc-predef.h
.
@AaronBallman Consider fixing.
Relevant code from glibc, include/features.h
:
/* Get definitions of __STDC_* predefined macros, if the compiler has
not preincluded this header automatically. */
#include <stdc-predef.h>
@llvm/issue-subscribers-clang-driver
Sample code:
Invocation:
Expected diagnostics:
Actual diagnostics:
If clang under non-strict floating-point models does not conform to the specifications in the Annex F, then for which purpose it defines
__STDC_IEC_559__
to1
?