| 1 |
/* Test silencing C++20 va_opt pedwarns. */ |
| 2 |
|
| 3 |
#pragma GCC diagnostic push |
| 4 |
|
| 5 |
void f() |
| 6 |
{ |
| 7 |
#define MAC1(FMT, ...) __builtin_printf ((FMT) __VA_OPT__(,) __VA_ARGS__) |
| 8 |
/* { dg-error "variadic macro" "" { target { c++98_only } } .-1 } */ |
| 9 |
/* { dg-error "VA_OPT" "" { target { c++17_down } } .-2 } */ |
| 10 |
MAC1("foo"); /* { dg-error "empty macro arguments" "" { target c++98_only } } */ |
| 11 |
/* { dg-error "at least one argument" "" { target c++17_down } .-1 } */ |
| 12 |
|
| 13 |
#pragma GCC diagnostic ignored "-Wvariadic-macros" |
| 14 |
#pragma GCC diagnostic ignored "-Wc++20-extensions" |
| 15 |
|
| 16 |
#define MAC2(FMT, ...) __builtin_printf ((FMT) __VA_OPT__(,) __VA_ARGS__) |
| 17 |
MAC2("foo"); |
| 18 |
} |