aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@gnu.org>1993-09-28 00:23:58 +0000
committerPaul Eggert <eggert@gnu.org>1993-09-28 00:23:58 +0000
commit7dce5088a717c7645e182950f744e52eacb05b3b (patch)
tree3a8956a016a3998d1bf98bb185e0c99363574f96
parent6767265ceae1bd6fd5bade2d2a4095970f3329df (diff)
downloadgcc-7dce5088a717c7645e182950f744e52eacb05b3b.zip
gcc-7dce5088a717c7645e182950f744e52eacb05b3b.tar.gz
gcc-7dce5088a717c7645e182950f744e52eacb05b3b.tar.bz2
(output_quoted_string): New function.
(output_file_directive): Quote special characters in file names. From-SVN: r5499
-rw-r--r--gcc/toplev.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index b513c5e..4290283 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1498,6 +1498,24 @@ strip_off_ending (name, len)
name[len - 4] = 0;
}
+/* Output a quoted string. */
+void
+output_quoted_string (asm_file, string)
+ FILE *asm_file;
+ char *string;
+{
+ char c;
+
+ putc ('\"', asm_file);
+ while ((c = *string++) != 0)
+ {
+ if (c == '\"' || c == '\\')
+ putc ('\\', asm_file);
+ putc (c, asm_file);
+ }
+ putc ('\"', asm_file);
+}
+
/* Output a file name in the form wanted by System V. */
void
@@ -1522,7 +1540,9 @@ output_file_directive (asm_file, input_name)
#ifdef ASM_OUTPUT_SOURCE_FILENAME
ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
#else
- fprintf (asm_file, "\t.file\t\"%s\"\n", na);
+ fprintf (asm_file, "\t.file\t");
+ output_quoted_string (asm_file, na);
+ fputc ('\n', asm_file);
#endif
#endif
}