diff options
Diffstat (limited to 'gnu/usr.bin/cc/cpp/cccp.c')
-rw-r--r-- | gnu/usr.bin/cc/cpp/cccp.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/gnu/usr.bin/cc/cpp/cccp.c b/gnu/usr.bin/cc/cpp/cccp.c index d514466..609249b 100644 --- a/gnu/usr.bin/cc/cpp/cccp.c +++ b/gnu/usr.bin/cc/cpp/cccp.c @@ -604,14 +604,14 @@ static struct default_include { automatically in Makefile.in. */ { CROSS_INCLUDE_DIR, 0, 0 }, /* This is another place that the target system's headers might be. */ - { TOOL_INCLUDE_DIR, 0, 1 }, + { TOOL_INCLUDE_DIR, 0, 0 }, #else /* not CROSS_COMPILE */ /* This should be /usr/local/include and should come before the fixincludes-fixed header files. */ { LOCAL_INCLUDE_DIR, 0, 1 }, /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here. Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */ - { TOOL_INCLUDE_DIR, 0, 1 }, + { TOOL_INCLUDE_DIR, 0, 0 }, /* This is the dir for fixincludes. Put it just before the files that we fix. */ { GCC_INCLUDE_DIR, 0, 0 }, @@ -3275,10 +3275,10 @@ startagain: /* This is now known to be a macro call. Discard the macro name from the output, along with any following whitespace just copied, - but preserve newlines at the top level since this + but preserve newlines if not outputting marks since this is more likely to do the right thing with line numbers. */ obp = op->buf + obufp_before_macroname; - if (ip->macro != 0) + if (output_marks) op->lineno = op_lineno_before_macroname; else { int newlines = op->lineno - op_lineno_before_macroname; @@ -9031,16 +9031,18 @@ dump_single_macro (hp, of) concat = 0; for (ap = defn->pattern; ap != NULL; ap = ap->next) { dump_defn_1 (defn->expansion, offset, ap->nchars, of); - if (ap->nchars != 0) - concat = 0; offset += ap->nchars; - if (ap->stringify) - fprintf (of, " #"); - if (ap->raw_before && !concat) - fprintf (of, " ## "); - concat = 0; + if (!traditional) { + if (ap->nchars != 0) + concat = 0; + if (ap->stringify) + fprintf (of, " #"); + if (ap->raw_before && !concat) + fprintf (of, " ## "); + concat = 0; + } dump_arg_n (defn, ap->argno, of); - if (ap->raw_after) { + if (!traditional && ap->raw_after) { fprintf (of, " ## "); concat = 1; } @@ -9069,7 +9071,7 @@ dump_all_macros () /* Output to OF a substring of a macro definition. BASE is the beginning of the definition. Output characters START thru LENGTH. - Discard newlines outside of strings, thus + Unless traditional, discard newlines outside of strings, thus converting funny-space markers to ordinary spaces. */ static void @@ -9082,16 +9084,20 @@ dump_defn_1 (base, start, length, of) U_CHAR *p = base + start; U_CHAR *limit = base + start + length; - while (p < limit) { - if (*p == '\"' || *p =='\'') { - U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, - NULL_PTR, NULL_PTR); - fwrite (p, p1 - p, 1, of); - p = p1; - } else { - if (*p != '\n') - putc (*p, of); - p++; + if (traditional) + fwrite (p, sizeof (*p), length, of); + else { + while (p < limit) { + if (*p == '\"' || *p =='\'') { + U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, + NULL_PTR, NULL_PTR); + fwrite (p, sizeof (*p), p1 - p, of); + p = p1; + } else { + if (*p != '\n') + putc (*p, of); + p++; + } } } } |