| Issue |
109677
|
| Summary |
clang++-19 -std=gnu++14 -Wc++20-extensions wrongly warns about GNU variadic macro extension
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
jinkama-san
|
Hi,
for simple code like
```
#ifdef DEBUG
# define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
# define DBG(fmt, ...)
#endif
#include <stdio.h>
int main()
{
DBG("Test\n");
}
```
compiled with `clang++-19 -std=gnu++14 test-variadic-macro.cpp -Wc++20-extensions` now this incorrect (for C++14 *with* GNU extensions) warning shows:
```
test-variadic-macro.cpp:11:14: warning: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Wc++20-extensions]
11 | DBG("Test\n");
| ^
test-variadic-macro.cpp:4:10: note: macro 'DBG' defined here
4 | # define DBG(fmt, ...)
| ^
1 warning generated.
```
This breaks a lot of code in release mode compiles. Also adding `-Wno-gnu-zero-variadic-macro-arguments` after `-Wc++20-extensions` doesn't help here. All earlier clang versions I tested including clang-18.1.8 got this right and didn't warn.
Maybe related to issue #76375
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs