llvm-project/clang/test/Preprocessor/stdc-ms-extension.cpp
Reagan 778dbcbbb5
[clang] Add /Zc:__STDC__ flag to clang-cl (#68690)
This commit adds the /Zc:\_\_STDC\_\_ argument from MSVC, which defines
\_\_STDC_\_.
This means, alongside stronger feature parity with MSVC, that things
that rely on \_\_STDC\_\_, such as autoconf, can work.
Link to MSVC documentation of this flag:
https://learn.microsoft.com/en-us/cpp/build/reference/zc-stdc?view=msvc-170
2024-05-24 23:48:13 -04:00

10 lines
665 B
C++

// RUN: %clang_cl /TC /dev/null /E -Xclang -dM 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=NOSTDC
// RUN: %clang_cl /TC /dev/null /E -Xclang -dM /Zc:__STDC__ 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=YESSTDC
// __STDC__ should never be defined in C++ mode with fms-compatibility.
// RUN: %clang_cl /dev/null /E -Xclang -dM 2>&1 | FileCheck %s --check-prefix=NOSTDC
// RUN: %clang_cl /dev/null /E -Xclang -dM /Zc:__STDC__ 2>&1 | FileCheck %s --check-prefix=ZCSTDCIGNORED
// YESSTDC: #define __STDC__ 1
// NOSTDC-NOT: #define __STDC__ 1
// ZCSTDCIGNORED-NOT: #define __STDC__ 1
// ZCSTDCIGNORED: argument unused during compilation