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