From b1af4777420641d90fc71bc8f34782d9568b3f01 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Fri, 25 Sep 1992 22:01:36 +0000 Subject: [PATCH] (do_include): "Concatenate" multiple "strings" in #include. From-SVN: r2248 --- gcc/cccp.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index c22bddc72d1..9b3c95e32de 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -3672,11 +3672,29 @@ get_filename: switch (*fbeg++) { case '\"': - fend = fbeg; - while (fend != limit && *fend != '\"') - fend++; - if (*fend == '\"' && fend + 1 == limit) { + { FILE_BUF *fp; + /* Copy the operand text, concatenating the strings. */ + { + U_CHAR *fin = fbeg; + fbeg = (U_CHAR *) alloca (limit - fbeg + 1); + fend = fbeg; + while (fin != limit) { + while (fin != limit && *fin != '\"') + *fend++ = *fin++; + fin++; + if (fin == limit) + break; + /* If not at the end, there had better be another string. */ + /* Skip just horiz space, and don't go past limit. */ + while (fin != limit && is_hor_space[*fin]) fin++; + if (fin != limit && *fin == '\"') + fin++; + else + goto fail; + } + } + *fend++ = 0; /* We have "filename". Figure out directory this source file is coming from and put it on the front of the list. */ -- 2.30.2