aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/raw-string-directive-2.c
blob: 6fc673ccd82be83c6fd34b879ff32ac59e0bbdc9 (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
/* { dg-do run } */
/* { dg-options "-std=gnu99" { target c } } */
/* { dg-options "-std=c++11" { target c++ } } */

#define S1 R"(three
line
string)"

#define S2 R"(pasted
two line)" " string"

#define X(a, b) a b R"(
one more)"

const char *s1 = S1;
const char *s2 = S2;
const char *s3 = X(S1, R"(
with this line plus)");

int main ()
{
  const char s1_correct[] = "three\nline\nstring";
  if (__builtin_memcmp (s1, s1_correct, sizeof s1_correct))
    __builtin_abort ();

  const char s2_correct[] = "pasted\ntwo line string";
  if (__builtin_memcmp (s2, s2_correct, sizeof s2_correct))
    __builtin_abort ();

  const char s3_correct[] = "three\nline\nstring\nwith this line plus\none more";
  if (__builtin_memcmp (s3, s3_correct, sizeof s3_correct))
    __builtin_abort ();
}