Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/trad/literals-1.c

raw
1 /* Test that (what looks like) comments are not recognized in literals
2 and that quotes within quotes do not confused the preprocessor. */
3
4 /* { dg-do run } */
5
6 extern void abort (void);
7
8 int main ()
9 {
10 const char *str1 = "/*";
11 const char *str2 = "'";
12
13 if (str1[0] != '/' || str1[1] != '*' || str1[2] != '\0')
14 abort ();
15
16 if (str2[0] != '\'' || str2[1] != '\0')
17 abort ();
18
19 #if '"' != '\"'
20 # error /* { dg-bogus "error" "double quote in charconst" } */
21 #endif
22
23 #if !'\''
24 # error quote /* { dg-bogus "quote" "quote in charconst" } */
25 #endif
26
27 return 0;
28 }