xref: /Universal-ctags/Units/parser-c.r/c-trigraphs.d/input.c (revision d6d1a0f2b90a600bdec9cd6ba964ee69382743e4)
1 
2 /* simple trigraphs */
3 ??=define A 1
4 ??=define B 2
5 ??=define STRINGIFY_INTERN(x) ??=x
6 ??=define STRINGIFY(x) STRINGIFY_INTERN(x)
7 
8 /* doesn't expand to anything that makes sense, but as "???" is not a valid
9  * trigraph it should not prevent "??/" to match */
10 ??=define D 4 ???/
11 #define bug1
12 ??=define E ?????/
13 #define bug2
14 
15 /* \ isn't interpreted for trigraphs */
16 ??=define F ???\??/
17 extern int bug3 = ??-0;
18 
19 ??=define M3_INIT(a, b, c) ??< a, b, c ??>
20 typedef int matrix3??(3??);
21 
22 struct str ??<
23   char *buf;
24   unsigned int len, size;
25 ??>;
26 
main(void)27 int main(void)
28 ??<
29   const char *hello = STRINGIFY(hello);
30   matrix3 m = M3_INIT(1, 2, 3);
31 
32   return m??(2??);
33 ??>
34 
35 /* FIXME: how to test "??'" ("^"), "??!" ("|") and "??-" ("~")?
36  *        I can't think of a construct CTags cares about using those */
37 
38 ??=if 0
39 #define bug4
40 ??=endif
41 
42 
43 /* test the same with untaken preprocessor paths (as they are then not read by
44  * the C parser but get.c) */
45 #if 0
46 
47 ??=define if0d_A 1
48 ??=define if0d_B 2
49 ??=define if0d_C 4 ???/
50 #define bug5
51 ??=define I ?????/
52 #define bug6
53 ??=define I ??????????/
54 #define bug7
55 
56 #endif
57