llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.79k stars 11.9k forks source link

clang-cl: ignore /Zc:preprocessor #47564

Open llvmbot opened 3 years ago

llvmbot commented 3 years ago
Bugzilla Link 48220
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @P-p-H-d,@zygoloid

Extended Description

Visual C++ 2019 has new compiler option /Zc:preprocessor for ISO C++ conformance. As clang should be conforming by default, it should ignore them instead of issuing a warning "argument unused during compilation". https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/ https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-160

P-p-H-d commented 3 years ago

It seems that there is more to do than just ignoring the warning.

The following code :

define M_RETI_ARG76(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, ...) _76

define M_COMMA_P(...) M_RETI_ARG76(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, useless)

M_COMMA_P( , ) M_COMMA_P( a )

produces when preprocessed (-E) : 1 0 on GCC (all), CLANG (Linux & MacOs), TCC, MSVC CL (/Zc:preprocessor)

whereas it produces : 0 0 on CLANG (Windows), MSVS CL (no /Zc:preprocessor)