llvm-project/clang/test/Preprocessor/empty_va_arg.cpp
Sirraide 5231005193
[Clang] Update missing varargs arg extension warnings (#84520)
This updates a few warnings that were diagnosing no arguments for a
`...` variadic macro parameter as a GNU extension when it actually is a
C++20/C23 extension now.

This fixes #84495.
2024-03-20 19:19:30 +01:00

17 lines
955 B
C++

// RUN: %clang_cc1 -Eonly -std=c17 -pedantic -verify=c17,expected -x c %s
// RUN: %clang_cc1 -Eonly -std=c23 -pedantic -Wpre-c23-compat -verify=c23,expected -x c %s
// RUN: %clang_cc1 -Eonly -std=c++17 -pedantic -verify=cxx17,expected %s
// RUN: %clang_cc1 -Eonly -std=c++20 -pedantic -Wpre-c++20-compat -verify=cxx20,expected %s
// silent-no-diagnostics
#define FOO(x, ...) // expected-note {{macro 'FOO' defined here}}
int main() {
FOO(42) // c17-warning {{passing no argument for the '...' parameter of a variadic macro is a C23 extension}} \
// cxx17-warning {{passing no argument for the '...' parameter of a variadic macro is a C++20 extension}} \
// c23-warning {{passing no argument for the '...' parameter of a variadic macro is incompatible with C standards before C23}} \
// cxx20-warning {{passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20}}
}