OSDN Git Service

* tree-loop-linear.c (try_interchange_loops): Compare memory access
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / spacing1.c
1 /* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.  */
2
3 /* { dg-do preprocess } */
4
5 /* This tests correct spacing of macro expansion output, as well as
6    the line it falls on.  This is quite subtle; it involves newlines
7    within macro arguments becoming spaces, but not if it turns out to
8    not be a macro invocation.  Also, multiple macro invocations spread
9    across many lines.
10
11    Neil Booth, 1 Dec 2000, 23 Sep 2001.  */
12
13 /* The actual location of the expansion of a multi-line macro
14    invocation is not defined: we might consider them to be in the same
15    line as the initial token of the invocation, or as the final token
16    of the invocation, or even anything in between.  We choose to make
17    it the initial token, such that everything that is in a logical
18    line ends up in a single line after preprocessing.
19
20    Alexandre Oliva, Sept 13, 2003.  */
21
22 #define str(x) #x
23 #define f(x) x
24 #define glue(x, y) x ## y
25 #define EMPTY
26 /* These are based on PR 4492, we mustn't lose padding tokens when
27    scanning ahead for a '(' and failing to find it.  */
28 #define A(x) B x
29 #define B(x)
30 #define C A
31 #define D() A
32
33 /* The correct output is shown here.  Note the spaces, and the way
34    everything after the invocation of f appears on the same line.
35
36  44 ;
37 B Q B Q A Q A:
38 f
39 bar
40 A
41 bad
42 g "1 2" bam baz
43
44 */
45
46 glue (EMPTY 4, 4) EMPTY;
47 A(Q) C(Q) D()Q D():
48 f
49 bar
50 A
51 bad
52 f (g) str
53 (
54 1
55 2
56 ) f
57 (bam) baz
58
59 /* { dg-final { scan-file spacing1.i " 44 ;" } }
60    { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } }
61    { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } }
62    { dg-final { scan-file spacing1.i "(^|\n)bar" } }
63    { dg-final { scan-file spacing1.i "(^|\n)A($|\n)" } }
64    { dg-final { scan-file spacing1.i "(^|\n)bad($|\n)" } }
65    { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */