[llvm-bugs] [Bug 52144] New: Clang on Windows: MSVC compatibility: values of __STDC__ do not match between Clang and MSVC

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 11 15:37:43 PDT 2021


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

            Bug ID: 52144
           Summary: Clang on Windows: MSVC compatibility: values of
                    __STDC__ do not match between Clang and MSVC
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            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

Sample code (t980.c):
#include <stdio.h>

int main()
{
#ifdef __STDC__
        printf("__STDC__ is defined to %d\n", __STDC__);
#else
        printf("__STDC__ is not defined\n");
#endif
        return 0;
}

Invocations:
$ cl t980.c /std:c11 /Za && ./t980.exe
__STDC__ is defined to 1

$ clang t980.c --std=c11 -pedantic -Wall -Wextra && ./a.exe
__STDC__ is not defined

Here we see that values of __STDC__ do not match between Clang and MSVC. I.e.
there is no MSVC compatibility w.r.t. __STDC__. Why? Unexpected.

Tool versions:
$ cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64

$ clang --version
clang version 12.0.0
Target: x86_64-pc-windows-msvc

-- 
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/20211011/a1f84069/attachment.html>


More information about the llvm-bugs mailing list