OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [spacing1.c] - Diff between revs 149 and 154

Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.  */
/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.  */
 
 
/* { dg-do preprocess } */
/* { dg-do preprocess } */
 
 
/* This tests correct spacing of macro expansion output, as well as
/* This tests correct spacing of macro expansion output, as well as
   the line it falls on.  This is quite subtle; it involves newlines
   the line it falls on.  This is quite subtle; it involves newlines
   within macro arguments becoming spaces, but not if it turns out to
   within macro arguments becoming spaces, but not if it turns out to
   not be a macro invocation.  Also, multiple macro invocations spread
   not be a macro invocation.  Also, multiple macro invocations spread
   across many lines.
   across many lines.
 
 
   Neil Booth, 1 Dec 2000, 23 Sep 2001.  */
   Neil Booth, 1 Dec 2000, 23 Sep 2001.  */
 
 
/* The actual location of the expansion of a multi-line macro
/* The actual location of the expansion of a multi-line macro
   invocation is not defined: we might consider them to be in the same
   invocation is not defined: we might consider them to be in the same
   line as the initial token of the invocation, or as the final token
   line as the initial token of the invocation, or as the final token
   of the invocation, or even anything in between.  We choose to make
   of the invocation, or even anything in between.  We choose to make
   it the initial token, such that everything that is in a logical
   it the initial token, such that everything that is in a logical
   line ends up in a single line after preprocessing.
   line ends up in a single line after preprocessing.
 
 
   Alexandre Oliva, Sept 13, 2003.  */
   Alexandre Oliva, Sept 13, 2003.  */
 
 
#define str(x) #x
#define str(x) #x
#define f(x) x
#define f(x) x
#define glue(x, y) x ## y
#define glue(x, y) x ## y
#define EMPTY
#define EMPTY
/* These are based on PR 4492, we mustn't lose padding tokens when
/* These are based on PR 4492, we mustn't lose padding tokens when
   scanning ahead for a '(' and failing to find it.  */
   scanning ahead for a '(' and failing to find it.  */
#define A(x) B x
#define A(x) B x
#define B(x)
#define B(x)
#define C A
#define C A
#define D() A
#define D() A
 
 
/* The correct output is shown here.  Note the spaces, and the way
/* The correct output is shown here.  Note the spaces, and the way
   everything after the invocation of f appears on the same line.
   everything after the invocation of f appears on the same line.
 
 
 44 ;
 44 ;
B Q B Q A Q A:
B Q B Q A Q A:
f
f
bar
bar
A
A
bad
bad
g "1 2" bam baz
g "1 2" bam baz
 
 
*/
*/
 
 
glue (EMPTY 4, 4) EMPTY;
glue (EMPTY 4, 4) EMPTY;
A(Q) C(Q) D()Q D():
A(Q) C(Q) D()Q D():
f
f
bar
bar
A
A
bad
bad
f (g) str
f (g) str
(
(
1
1
2
2
) f
) f
(bam) baz
(bam) baz
 
 
/* { dg-final { scan-file spacing1.i " 44 ;" } }
/* { dg-final { scan-file spacing1.i " 44 ;" } }
   { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } }
   { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } }
   { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } }
   { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } }
   { dg-final { scan-file spacing1.i "(^|\n)bar" } }
   { dg-final { scan-file spacing1.i "(^|\n)bar" } }
   { dg-final { scan-file spacing1.i "(^|\n)A($|\n)" } }
   { dg-final { scan-file spacing1.i "(^|\n)A($|\n)" } }
   { dg-final { scan-file spacing1.i "(^|\n)bad($|\n)" } }
   { dg-final { scan-file spacing1.i "(^|\n)bad($|\n)" } }
   { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */
   { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */
 
 

powered by: WebSVN 2.1.0

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