<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/109677>109677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang++-19 -std=gnu++14 -Wc++20-extensions wrongly warns about GNU variadic macro extension
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jinkama-san
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2TpDYM_TXuiwrKiG6gDxz6Y2aSQ3JIdrPHKYMFeMfYXbaZzuTXpwz9sbW1s7MUZcBY0tPTk4T3qjdENdvs2ea4ElMYrKu_KvMiRpF4YVaNlW_1b4rhgfEj47tl7awDr8aTJmitJNDqhb79zwp-uZdPzFUnqYPjw_7z020PJHXKEBz3TwyrbgwMD5CmKcMtnJwyobtvM8wZ5s_P_-yed389_f38zHB7c0Ta0694vRsYqbo7NtPqSRKw_OCDVDYdWP6w_FUmwCiUYVjd7cv98nIJwRA_kQ9sczAMMR7L99eTxx_zMa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