Commit aa90b111 by Zack Weinberg Committed by Jeff Law

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
parent f0c76b51
...@@ -6,6 +6,11 @@ Wed Sep 30 19:33:07 1998 Jeffrey A Law (law@cygnus.com) ...@@ -6,6 +6,11 @@ Wed Sep 30 19:33:07 1998 Jeffrey A Law (law@cygnus.com)
Wed Sep 30 19:13:20 1998 Zack Weinberg <zack@rabi.phys.columbia.edu> Wed Sep 30 19:13:20 1998 Zack Weinberg <zack@rabi.phys.columbia.edu>
* 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.
* toplev.c (documented_lang_options): Recognize -include, * toplev.c (documented_lang_options): Recognize -include,
-imacros, -iwithprefix, -iwithprefixbefore. -imacros, -iwithprefix, -iwithprefixbefore.
* cpplib.c (cpp_start_read): Process -imacros and -include * cpplib.c (cpp_start_read): Process -imacros and -include
......
...@@ -2874,11 +2874,6 @@ macroexpand (pfile, hp) ...@@ -2874,11 +2874,6 @@ macroexpand (pfile, hp)
while (p1 != l1 && is_space[*p1]) p1++; while (p1 != l1 && is_space[*p1]) p1++;
while (p1 != l1 && is_idchar[*p1]) while (p1 != l1 && is_idchar[*p1])
xbuf[totlen++] = *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) if (ap->raw_after)
{ {
...@@ -2887,21 +2882,38 @@ macroexpand (pfile, hp) ...@@ -2887,21 +2882,38 @@ macroexpand (pfile, hp)
while (p1 != l1) while (p1 != l1)
{ {
if (is_space[l1[-1]]) 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] == '-') else if (l1[-1] == '-')
{ {
U_CHAR *p2 = l1 - 1; U_CHAR *p2 = l1 - 1;
/* If a `-' is preceded by an odd number of newlines then it /* If a `-' is preceded by an odd number of
and the last newline are a no-reexpansion marker. */ `@' signs then it and the last `@' are
while (p2 != p1 && p2[-1] == '\n') p2--; a no-reexpansion marker. */
if ((l1 - 1 - p2) & 1) { while (p2 != p1 && p2[-1] == '@') p2--;
if ((l1 - 1 - p2) & 1)
l1 -= 2; l1 -= 2;
} else
else break; 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); bcopy (p1, xbuf + totlen, l1 - p1);
totlen += l1 - p1; totlen += l1 - p1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment