[llvm-bugs] [Bug 52533] New: __STDC_IEC_559__ depends on #include <stdio.h>: confused

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 17 04:19:48 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52533

            Bug ID: 52533
           Summary: __STDC_IEC_559__ depends on #include <stdio.h>:
                    confused
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pavel.morozkin at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Note: this may not be a bug. However, it is expected that __STDC_IEC_559__ does
not depend on any #include and stays constant during the translation.

This code:
#include FNAME
#if __STDC_IEC_559__ == 1
#pragma message "__STDC_IEC_559__ is 1"
#else
#pragma message "__STDC_IEC_559__ is not 1"
#endif

compiled with:
$ clang t0.c -std=c11 -pedantic -Wall -Wextra -DFNAME="<stdio.h>"

leads to:
t0.c:3:9: warning: __STDC_IEC_559__ is 1 [-W#pragma-messages]

while compiled with:
$ clang t0.c -std=c11 -pedantic -Wall -Wextra -DFNAME="<float.h>"

leads to:
t0.c:3:9: warning: __STDC_IEC_559__ is not 1 [-W#pragma-messages]

Here we see that the value of __STDC_IEC_559__ depends on #include. Which is
confusing. Please explain / investigate.

Version: clang 13.0.0 on Linux on x86_64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211117/49678eee/attachment.html>


More information about the llvm-bugs mailing list