LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 48220 - clang-cl: ignore /Zc:preprocessor
Summary: clang-cl: ignore /Zc:preprocessor
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-18 14:09 PST by Lev Rumyantsev
Modified: 2021-01-10 09:58 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lev Rumyantsev 2020-11-18 14:09:22 PST
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
Comment 1 PpHd 2021-01-10 09:58:44 PST
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)