aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom Wood <wood@gnu.org>1992-09-02 16:09:16 +0000
committerTom Wood <wood@gnu.org>1992-09-02 16:09:16 +0000
commitef9429af779b19e68062c50cb38e0f6b32fc424e (patch)
treeb2aa80ef8149d38b22a538a44d624b53d81ca426 /gcc
parentd0dcc580cfd3c8a166c3db09cb46eafa32f32ef4 (diff)
downloadgcc-ef9429af779b19e68062c50cb38e0f6b32fc424e.zip
gcc-ef9429af779b19e68062c50cb38e0f6b32fc424e.tar.gz
gcc-ef9429af779b19e68062c50cb38e0f6b32fc424e.tar.bz2
(output_ascii): Output known escape characters and don't
terminate the constant if an octal escape is used. From-SVN: r2029
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/m88k/m88k.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c
index 2c31eba..2c7c33e 100644
--- a/gcc/config/m88k/m88k.c
+++ b/gcc/config/m88k/m88k.c
@@ -46,7 +46,7 @@ extern char *ctime ();
extern int flag_traditional;
extern FILE *asm_out_file;
-static char out_sccs_id[] = "@(#)m88k.c 2.2.6.9 04 Jul 1992 13:17:36";
+static char out_sccs_id[] = "@(#)m88k.c 2.2.7.2 08/31/92 13:26:22";
static char tm_sccs_id [] = TM_SCCS_ID;
char *m88k_pound_sign = ""; /* Either # for SVR4 or empty for SVR3 */
@@ -1424,6 +1424,7 @@ output_ascii (file, opcode, max, p, size)
int size;
{
int i;
+ int in_escape = 0;
register int num = 0;
@@ -1437,29 +1438,45 @@ output_ascii (file, opcode, max, p, size)
fprintf (file, "\"\n\t%s\t \"", opcode);
num = 0;
}
-
+
if (c == '\"' || c == '\\')
{
+ escape:
putc ('\\', file);
- num++;
+ putc (c, file);
+ num += 2;
+ in_escape = 0;
}
-
- if (c >= ' ' && c < 0177)
+ else if (in_escape && c >= '0' && c <= '9')
+ {
+ /* If a digit follows an octal-escape, the Vax assembler fails
+ to stop reading the escape after three digits. Continue to
+ output the values as an octal-escape until a non-digit is
+ found. */
+ fprintf (file, "\\%03o", c);
+ num += 4;
+ }
+ else if (c >= ' ' && c < 0177)
{
putc (c, file);
num++;
+ in_escape = 0;
}
else
{
+ switch (c)
+ {
+ case '\t': c = 't'; goto escape;
+ case '\f': c = 'f'; goto escape;
+ case '\v': c = 'v'; goto escape;
+ case '\b': c = 'b'; goto escape;
+ case '\r': c = 'r'; goto escape;
+ case '\n': c = 'n'; goto escape;
+ }
+
fprintf (file, "\\%03o", c);
num += 4;
- /* After an octal-escape, if a digit follows,
- terminate one string constant and start another.
- The Vax assembler fails to stop reading the escape
- after three digits, so this is the only way we
- can get it to parse the data properly. */
- if (i < size - 1 && p[i + 1] >= '0' && p[i + 1] <= '9')
- num = max + 1; /* next pass will start a new string */
+ in_escape = 1;
}
}
fprintf (file, "\"\n");