[clang] [clang] Add test for CWG3088 about macros defining special identifiers (PR #189309)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 05:25:55 PDT 2026
AaronBallman wrote:
> I think that movement of [macro.names]/2 to the core language wording should've been a DR and we should treat it as such, but this is up for discussion. Attributes situation is also concerning.
>
> CC @AaronBallman as attributes maintainer.
This change will break code:
https://sourcegraph.com/search?q=context:global+lang:C%2B%2B+%28%23define+assume%5Cb%29+-file:.*test.*+-file:.*clang.*&patternType=regexp&case=yes&sm=0
This search even shows how particularly bad the overreach is:
https://sourcegraph.com/search?q=context:global+lang:C%2B%2B+%28%23define+fallthrough%5Cb%29+-file:.*test.*+-file:.*clang.*&patternType=regexp&case=yes&sm=0
the first result shows `#define fallthrough()` as a macro; that's now invalid even though it cannot actually conflict with any standard usage of the attribute because it's a function-like macro.
I'm not super inclined to treat this as a DR in older language modes as it feels user hostile in some of these cases (the `fallthrough()` case is particularly difficult to justify). But if we're only exposing this as a warning, we could expose it under its own flag so users can disable it if they need to.
https://github.com/llvm/llvm-project/pull/189309
More information about the cfe-commits
mailing list