summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cpp/va-opt-error.c
blob: f32f0551723d597236dad70d9c259907f865ad71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { dg-do preprocess }*/
/* { dg-options "-std=gnu99" { target c } } */
/* { dg-options "-std=c++2a" { target c++ } } */

#define ERR1(x) __VA_OPT__ /* { dg-warning "__VA_OPT__ can only appear" } */
#define ERR2(x) __VA_OPT__( /* { dg-warning "can only appear" } */
#define ERR3(x) __VA_OPT__() /* { dg-warning "can only appear" } */

#define ERR4(x,...) __VA_OPT__ /* { dg-error "unterminated __VA_OPT__" } */
#define ERR5(x,...) __VA_OPT__( /* { dg-error "unterminated" } */
#define ERR6(x,...) __VA_OPT__(() /* { dg-error "unterminated" } */

#define ERR7(x,...) __VA_OPT__(__VA_OPT__) /* { dg-error "may not appear" } */
#define ERR7(x,...) __VA_OPT__(__VA_OPT__()) /* { dg-error "may not appear" } */

#define ERR8(x, y,...) x __VA_OPT__(##) y /* { dg-error "either end" } */
#define ERR9(x, y,...) x __VA_OPT__(x ##) y /* { dg-error "either end" } */
#define ERRA(x, y,...) x x __VA_OPT__(## y) /* { dg-error "either end" } */

#define ERRB __VA_OPT__ /* { dg-warning "can only appear" } */
#define ERRC(__VA_OPT__) x /* { dg-warning "can only appear" } */

__VA_OPT__ /* { dg-warning "can only appear" } */

#define ERRD(x)
ERRD(__VA_OPT__) /* { dg-warning "can only appear" } */

#define __VA_OPT__ /* { dg-warning "can only appear" } */