Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/cpp/va-opt.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-options "-std=gnu99" { target c } } */ | |
3 /* { dg-options "-std=c++2a" { target c++ } } */ | |
4 | |
5 extern void f0 (void); | |
6 extern void f1 (int); | |
7 extern void f2 (int, int); | |
8 extern void f3 (int, int, int); | |
9 extern void f4 (int, int, int, int); | |
10 extern int s (const char *); | |
11 | |
12 #define CALL(F, ...) F (7 __VA_OPT__(,) __VA_ARGS__) | |
13 #define CP(F, X, Y, ...) F (__VA_OPT__(X ## Y,) __VA_ARGS__) | |
14 #define CS(F, ...) F(__VA_OPT__(s(# __VA_ARGS__))) | |
15 #define D(F, ...) F(__VA_OPT__(__VA_ARGS__) __VA_OPT__(,) __VA_ARGS__) | |
16 #define CALL0(...) __VA_OPT__(f2)(0 __VA_OPT__(,)__VA_ARGS__) | |
17 | |
18 void t (void) | |
19 { | |
20 CALL (f1); | |
21 CALL (f1, ); | |
22 CALL (f2, 1); | |
23 CALL (f3, 1, 2); | |
24 | |
25 int one = 1; | |
26 int two = 2; | |
27 int onetwo = 23; | |
28 | |
29 CP (f0, one, two); | |
30 CP (f0, one, two, ); | |
31 CP (f2, one, two, 3); | |
32 | |
33 CS (f0); | |
34 CS (f1, 1, 2, 3, 4); | |
35 | |
36 D (f0); | |
37 D (f2, 1); | |
38 D (f4, 1, 2); | |
39 | |
40 CALL0 (); | |
41 CALL0 (23); | |
42 } |