Commit f46b6be4 by Richard Kenner

(dump_single_macro, dump_defn_1): If -traditional, dump macros in traditional style.

(dump_single_macro, dump_defn_1): If -traditional, dump macros in
traditional style.  This also avoids a bogus error message if the
macro uses traditional stringizing.

From-SVN: r8405
parent f6eb850d
...@@ -9031,16 +9031,18 @@ dump_single_macro (hp, of) ...@@ -9031,16 +9031,18 @@ dump_single_macro (hp, of)
concat = 0; concat = 0;
for (ap = defn->pattern; ap != NULL; ap = ap->next) { for (ap = defn->pattern; ap != NULL; ap = ap->next) {
dump_defn_1 (defn->expansion, offset, ap->nchars, of); dump_defn_1 (defn->expansion, offset, ap->nchars, of);
if (ap->nchars != 0)
concat = 0;
offset += ap->nchars; offset += ap->nchars;
if (ap->stringify) if (!traditional) {
fprintf (of, " #"); if (ap->nchars != 0)
if (ap->raw_before && !concat) concat = 0;
fprintf (of, " ## "); if (ap->stringify)
concat = 0; fprintf (of, " #");
if (ap->raw_before && !concat)
fprintf (of, " ## ");
concat = 0;
}
dump_arg_n (defn, ap->argno, of); dump_arg_n (defn, ap->argno, of);
if (ap->raw_after) { if (!traditional && ap->raw_after) {
fprintf (of, " ## "); fprintf (of, " ## ");
concat = 1; concat = 1;
} }
...@@ -9069,7 +9071,7 @@ dump_all_macros () ...@@ -9069,7 +9071,7 @@ dump_all_macros ()
/* Output to OF a substring of a macro definition. /* Output to OF a substring of a macro definition.
BASE is the beginning of the definition. BASE is the beginning of the definition.
Output characters START thru LENGTH. 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. */ converting funny-space markers to ordinary spaces. */
static void static void
...@@ -9082,16 +9084,20 @@ dump_defn_1 (base, start, length, of) ...@@ -9082,16 +9084,20 @@ dump_defn_1 (base, start, length, of)
U_CHAR *p = base + start; U_CHAR *p = base + start;
U_CHAR *limit = base + start + length; U_CHAR *limit = base + start + length;
while (p < limit) { if (traditional)
if (*p == '\"' || *p =='\'') { fwrite (p, sizeof (*p), length, of);
U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, else {
NULL_PTR, NULL_PTR); while (p < limit) {
fwrite (p, p1 - p, 1, of); if (*p == '\"' || *p =='\'') {
p = p1; U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
} else { NULL_PTR, NULL_PTR);
if (*p != '\n') fwrite (p, sizeof (*p), p1 - p, of);
putc (*p, of); p = p1;
p++; } else {
if (*p != '\n')
putc (*p, of);
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