FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / digraphs.c
blob49a1bcd860492b868e18fbb3f95cb9a3a847c00a
1 /* Copyright (C) 2000 Free Software Foundation, Inc. */
3 /* { dg-do run } */
4 /* { dg-options "-std=c99" } */
6 /* Fully test the 6 digraphs under c99 assumptions. Four are pasted,
7 to check that digraph pasting works. */
9 extern int strcmp (const char *, const char *);
10 extern void abort (void);
11 extern int puts (const char *);
12 #define err(str) do { puts(str); abort(); } while (0)
14 %:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */
15 #ifndef glue
16 #error glue not defined!
17 #endif
18 %:define str(x) %:x /* #define str(x) #x */
20 int main (int argc, char *argv<::>) /* argv[] */
21 glue (<, %) /* { */
22 /* di_str[] = */
23 const char di_str glue(<, :)glue(:, >) = str(%:%:<::><%%>%:);
25 /* Check the glue macro actually pastes, and that the spelling of
26 all digraphs is preserved. */
27 if (glue(str, cmp) (di_str, "%:%:<::><%%>%:"))
28 err ("Digraph spelling not preserved!");
30 return 0;
31 glue (%, >) /* } */