From 5d83f44baa49fbeadb9b5c35cb15e3f8a860802f Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Wed, 4 Aug 1999 20:39:33 +0000 Subject: cpphash.c (macroexpand): Delete leading whitespace when arg is concatenated before. Wed Aug 4 13:29:23 1999 Zack Weinberg * cpphash.c (macroexpand): Delete leading whitespace when arg is concatenated before. (unsafe_chars): Correct test for whether + and - can extend a token. * cppinit.c (cpp_start_read): Do dependencies for -include/-imacros files also. * cpplib.c (cpp_scan_buffer): In no-output mode, don't bother tokenizing non-directive lines. (cpp_expand_to_buffer): Temporarily disable no-output mode. * cppmain.c: In no-output mode, just call cpp_scan_buffer for the input file. From-SVN: r28512 --- gcc/cpphash.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'gcc/cpphash.c') diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 552cf2e..2b5291b 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -1337,10 +1337,17 @@ macroexpand (pfile, hp) U_CHAR *l1 = p1 + arg->raw_length; if (ap->raw_before) { - while (p1 != l1 && is_space[*p1]) - p1++; - while (p1 != l1 && is_idchar[*p1]) - xbuf[totlen++] = *p1++; + /* Arg is concatenated before: delete leading whitespace, + whitespace markers, and no-reexpansion markers. */ + while (p1 != l1) + { + if (is_space[p1[0]]) + p1++; + else if (p1[0] == '\r') + p1 += 2; + else + break; + } } if (ap->raw_after) { @@ -1460,15 +1467,12 @@ unsafe_chars (c1, c2) { switch (c1) { - case '+': - case '-': + case '+': case '-': if (c2 == c1 || c2 == '=') return 1; goto letter; - case '.': case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': case '8': - case '9': case 'e': case 'E': case 'p': case 'P': + case 'e': case 'E': case 'p': case 'P': if (c2 == '-' || c2 == '+') return 1; /* could extend a pre-processing number */ goto letter; @@ -1478,6 +1482,8 @@ unsafe_chars (c1, c2) return 1; /* Could turn into L"xxx" or L'xxx'. */ goto letter; + case '.': case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': case '8': case '9': case '_': case 'a': case 'b': case 'c': case 'd': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'q': case 'r': case 's': -- cgit v1.1