annotate gcc/testsuite/gcc.dg/cpp/macro10.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Copyright (C) 2001 Free Software Foundation, Inc. */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* { dg-do preprocess } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 /* Source: Neil Booth, 23 Sep 2001.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 A tricky, pathological corner case we used to get wrong. Expansion
kono
parents:
diff changeset
8 should go as follows. The asterisk indicates the token has "blue
kono
parents:
diff changeset
9 paint" can no longer be macro expanded. We used to lose that
kono
parents:
diff changeset
10 information when parsing arguments and dropping to the lexer to get
kono
parents:
diff changeset
11 the ')'.
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 foo )
kono
parents:
diff changeset
14 bar foo* )
kono
parents:
diff changeset
15 func (foo* )
kono
parents:
diff changeset
16 foo*
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 If we try and expand the final foo, we get an "unterminated
kono
parents:
diff changeset
19 argument list invoking macro <func>" error. If we do the right
kono
parents:
diff changeset
20 thing and leave it as is, no diagnostics are emitted. */
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 #define func(x) x
kono
parents:
diff changeset
23 #define bar func(
kono
parents:
diff changeset
24 #define foo bar foo
kono
parents:
diff changeset
25 foo )