annotate gcc/testsuite/gcc.dg/cpp/digraphs.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Copyright (C) 2000 Free Software Foundation, Inc. */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* { dg-do run } */
kono
parents:
diff changeset
4 /* { dg-options "-std=c99" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 /* Fully test the 6 digraphs under c99 assumptions. Four are pasted,
kono
parents:
diff changeset
7 to check that digraph pasting works. */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 extern int strcmp (const char *, const char *);
kono
parents:
diff changeset
10 extern void abort (void);
kono
parents:
diff changeset
11 #if DEBUG
kono
parents:
diff changeset
12 extern int puts (const char *);
kono
parents:
diff changeset
13 #else
kono
parents:
diff changeset
14 #define puts(X)
kono
parents:
diff changeset
15 #endif
kono
parents:
diff changeset
16 #define err(str) do { puts(str); abort(); } while (0)
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 %:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */
kono
parents:
diff changeset
19 #ifndef glue
kono
parents:
diff changeset
20 #error glue not defined!
kono
parents:
diff changeset
21 #endif
kono
parents:
diff changeset
22 %:define str(x) %:x /* #define str(x) #x */
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 int main (int argc, char *argv<::>) /* argv[] */
kono
parents:
diff changeset
25 glue (<, %) /* { */
kono
parents:
diff changeset
26 /* di_str[] = */
kono
parents:
diff changeset
27 const char di_str glue(<, :)glue(:, >) = str(%:%:<::><%%>%:);
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 /* Check the glue macro actually pastes, and that the spelling of
kono
parents:
diff changeset
30 all digraphs is preserved. */
kono
parents:
diff changeset
31 if (glue(str, cmp) (di_str, "%:%:<::><%%>%:"))
kono
parents:
diff changeset
32 err ("Digraph spelling not preserved!");
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 return 0;
kono
parents:
diff changeset
35 glue (%, >) /* } */