aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-10-18 07:15:41 +0000
committerRichard Stallman <rms@gnu.org>1992-10-18 07:15:41 +0000
commite8db4813dbc1f2cd4425da69f5fb2062a5eb5b97 (patch)
treebe65920103fcbe9a961038e769e7cf5c7dd1d198 /gcc
parent057f494bb864e11120511dc8ba4e2b8f3916650a (diff)
downloadgcc-e8db4813dbc1f2cd4425da69f5fb2062a5eb5b97.zip
gcc-e8db4813dbc1f2cd4425da69f5fb2062a5eb5b97.tar.gz
gcc-e8db4813dbc1f2cd4425da69f5fb2062a5eb5b97.tar.bz2
(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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index dba4ef8..447f2f8 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -2352,14 +2352,15 @@ do { ip = &instack[indepth]; \
while (1) {
if (ibp >= limit) {
- if (traditional) {
- if (ip->macro != 0) {
- /* try harder: this string crosses a macro expansion boundary */
- POPMACRO;
- RECACHE;
- continue;
- }
- } else {
+ if (ip->macro != 0) {
+ /* try harder: this string crosses a macro expansion boundary.
+ This can happen naturally if -traditional.
+ Otherwise, only -D can make a macro with an unmatched quote. */
+ POPMACRO;
+ RECACHE;
+ continue;
+ }
+ if (!traditional) {
error_with_line (line_for_error (start_line),
"unterminated string or character constant");
error_with_line (multiline_string_line,
@@ -5220,8 +5221,10 @@ collect_expansion (buf, end, nargs, arglist)
*exp_p++ = '\n';
*exp_p++ = *limit++;
}
- } else if (!traditional) {
- /* There is no trailing whitespace, so invent some. */
+ } else if (!traditional && expected_delimiter == 0) {
+ /* 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++ = ' ';
}