aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-11-08 07:27:24 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-11-08 07:27:24 -0500
commitf46b6be4cb63130376b9e70358de9e907a165825 (patch)
treee7f40b42d43029ed11890939e94b22f3e28c3fa4
parentf6eb850d30efcd0d06682bf5099d9b543a386e3b (diff)
downloadgcc-f46b6be4cb63130376b9e70358de9e907a165825.zip
gcc-f46b6be4cb63130376b9e70358de9e907a165825.tar.gz
gcc-f46b6be4cb63130376b9e70358de9e907a165825.tar.bz2
(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
-rw-r--r--gcc/cccp.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 889285b..a53ce0f 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -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++;
+ }
}
}
}