Commit e8db4813 by Richard Stallman

(collect_expansion): Don't add whitespace at end if inside a string and not traditional.

(collect_expansion): Don't add whitespace at end
if inside a string and not traditional.
(rescan): At end of string, if inside macro, always keep scanning.

From-SVN: r2506
parent 057f494b
...@@ -2352,14 +2352,15 @@ do { ip = &instack[indepth]; \ ...@@ -2352,14 +2352,15 @@ do { ip = &instack[indepth]; \
while (1) { while (1) {
if (ibp >= limit) { if (ibp >= limit) {
if (traditional) { if (ip->macro != 0) {
if (ip->macro != 0) { /* try harder: this string crosses a macro expansion boundary.
/* try harder: this string crosses a macro expansion boundary */ This can happen naturally if -traditional.
POPMACRO; Otherwise, only -D can make a macro with an unmatched quote. */
RECACHE; POPMACRO;
continue; RECACHE;
} continue;
} else { }
if (!traditional) {
error_with_line (line_for_error (start_line), error_with_line (line_for_error (start_line),
"unterminated string or character constant"); "unterminated string or character constant");
error_with_line (multiline_string_line, error_with_line (multiline_string_line,
...@@ -5220,8 +5221,10 @@ collect_expansion (buf, end, nargs, arglist) ...@@ -5220,8 +5221,10 @@ collect_expansion (buf, end, nargs, arglist)
*exp_p++ = '\n'; *exp_p++ = '\n';
*exp_p++ = *limit++; *exp_p++ = *limit++;
} }
} else if (!traditional) { } else if (!traditional && expected_delimiter == 0) {
/* There is no trailing whitespace, so invent some. */ /* There is no trailing whitespace, so invent some in ANSI mode.
But not if "inside a string" (which in ANSI mode
happens only for -D option). */
*exp_p++ = '\n'; *exp_p++ = '\n';
*exp_p++ = ' '; *exp_p++ = ' ';
} }
......
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