OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [trad/] [macroargs.c] - Blame information for rev 378

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test that whitespace in arguments is preserved, and that each
2
   newline in macro arguments become a space.  */
3
 
4
/* { dg-do run } */
5
 
6
#define f(x, y) "x y"
7
#define g(x) x
8
 
9
extern void abort (void);
10
 
11
void testquoting ()
12
{
13
  const char *str1 = f("a", "\"a\"");
14
  const char *str2 = f( \t, " \t");
15
 
16
  if (strcmp (str1, "\"a\"  \"\\\"a\\\"\""))
17
    abort ();
18
  if (strcmp (str2, " \t  \" \\t\""))
19
    abort ();
20
}
21
 
22
int main ()
23
{
24
  const char *str1 = f( foo ,bar);
25
  const char *str2 = f(
26
foo
27
,bar);
28
 
29
  if (strcmp (str1, " foo  bar"))
30
    abort ();
31
 
32
  if (strcmp (str1, str2))
33
    abort ();
34
 
35
  /* Verify that quoted state is preserved over a newline.  */
36
  if (strcmp (g /* { dg-bogus "unterminated 2" } */ ("1
37
, 2"), "1 , 2"))
38
    abort ();
39
 
40
  testquoting ();
41
 
42
  return 0;
43
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.