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
9extern int strcmp (const char *, const char *);
10extern void abort (void);
11extern int puts (const char *);
12#define err(str) do { puts(str); abort(); } while (0)
13
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 */
19
20int main (int argc, char *argv<::>) /* argv[] */
21glue (<, %) /* { */
22             /* di_str[] = */
23  const char di_str glue(<, :)glue(:, >) = str(%:%:<::><%%>%:);
24
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!");
29
30  return 0;
31glue (%, >) /* } */
32