summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/trigraphs.c
blob: 3ec5ed7213567c80fca9246004e30e894e498cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* { dg-do run } */
/* { dg-options "-ansi" } */

extern void abort (void);

/* Basic tests for trigraph conversion.
   All of them are here, but not in all possible contexts.  *??/
/

??=include <stdio.h>

??=define TWELVE 1??/
2

static const char str??(??) = "0123456789??/n";

int
main(void)
??<
  unsigned char x = 5;

  if (sizeof str != TWELVE)
    abort ();

  /* Test ^=, the only multi-character token to come from trigraphs.  */
  x ??'= 3;
  if (x != 6)
    abort ();

  if ((5 ??! 3) != 7)
    abort ();

  return 0;
??>