aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.phys.columbia.edu>1998-09-30 19:27:28 +0000
committerJeff Law <law@gcc.gnu.org>1998-09-30 13:27:28 -0600
commitaa90b11170630993a99b1e18190e9f0a8e7b2265 (patch)
treea41dcb5cea7aab2ae8fb687f3d5c09e230857796 /gcc/cpplib.c
parentf0c76b51b4075e1bcbdf0aa427cfed3b6311e237 (diff)
downloadgcc-aa90b11170630993a99b1e18190e9f0a8e7b2265.zip
gcc-aa90b11170630993a99b1e18190e9f0a8e7b2265.tar.gz
gcc-aa90b11170630993a99b1e18190e9f0a8e7b2265.tar.bz2
cpplib.c (macroexpand): If arg->raw_before or arg->raw_after...
* cpplib.c (macroexpand): If arg->raw_before or arg->raw_after, remove any no-reexpansion escape at the beginning of the pasted token. Correct handling of whitespace markers and no-reexpand markers at the end if arg->raw_after. From-SVN: r22695
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index c605a4a..b37a779 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -2874,11 +2874,6 @@ macroexpand (pfile, hp)
while (p1 != l1 && is_space[*p1]) p1++;
while (p1 != l1 && is_idchar[*p1])
xbuf[totlen++] = *p1++;
- /* Delete any no-reexpansion marker that follows
- an identifier at the beginning of the argument
- if the argument is concatenated with what precedes it. */
- if (p1[0] == '@' && p1[1] == '-')
- p1 += 2;
}
if (ap->raw_after)
{
@@ -2887,21 +2882,38 @@ macroexpand (pfile, hp)
while (p1 != l1)
{
if (is_space[l1[-1]]) l1--;
+ else if (l1[-1] == '@')
+ {
+ U_CHAR *p2 = l1 - 1;
+ /* If whitespace is preceded by an odd number
+ of `@' signs, the last `@' was a whitespace
+ marker; drop it too. */
+ while (p2 != p1 && p2[-1] == '@') p2--;
+ if ((l1 - 1 - p2) & 1)
+ l1--;
+ break;
+ }
else if (l1[-1] == '-')
{
U_CHAR *p2 = l1 - 1;
- /* If a `-' is preceded by an odd number of newlines then it
- and the last newline are a no-reexpansion marker. */
- while (p2 != p1 && p2[-1] == '\n') p2--;
- if ((l1 - 1 - p2) & 1) {
+ /* If a `-' is preceded by an odd number of
+ `@' signs then it and the last `@' are
+ a no-reexpansion marker. */
+ while (p2 != p1 && p2[-1] == '@') p2--;
+ if ((l1 - 1 - p2) & 1)
l1 -= 2;
- }
- else break;
+ else
+ break;
}
else break;
}
}
+ /* Delete any no-reexpansion marker that precedes
+ an identifier at the beginning of the argument. */
+ if (p1[0] == '@' && p1[1] == '-')
+ p1 += 2;
+
bcopy (p1, xbuf + totlen, l1 - p1);
totlen += l1 - p1;
}