1 /* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */
3 /* { dg-do preprocess } */
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
11 Neil Booth, 1 Dec 2000, 23 Sep 2001. */
15 #define glue(x, y) x ## y
17 /* These are based on PR 4492, we mustn't lose padding tokens when
18 scanning ahead for a '(' and failing to find it. */
24 /* The correct output is shown here. Note the spaces, and the way
25 everything after the invocation of f appears on the same line.
35 glue (EMPTY 4, 4) EMPTY;
47 { dg-final { if ![file exists spacing1.i] { return } } }
48 { dg-final { if \{ [grep spacing1.i " 44 ;"] != "" \} \{ } }
49 { dg-final { if \{ [grep spacing1.i "B Q B Q A Q A:"] != "" \} \{ } }
50 { dg-final { if \{ [grep spacing1.i "f.*bar"] == "" \} \{ } }
51 { dg-final { if \{ [grep spacing1.i "^bar"] != "" \} \{ } }
52 { dg-final { if \{ [grep spacing1.i "g \"1 2\" bam baz"] != "" \} \{ } }
53 { dg-final { return \} \} \} \} \} } }
54 { dg-final { fail "spacing1.c: spacing and new-line preservation" } }