Commit 7b1e8272 by Paul Eggert

(ASM_FILE_START): Quote special characters in file names.

From-SVN: r5497
parent 73e2c650
...@@ -1311,7 +1311,9 @@ extern char *a29k_function_name; ...@@ -1311,7 +1311,9 @@ extern char *a29k_function_name;
for (p = main_input_filename; *p; p++) \ for (p = main_input_filename; *p; p++) \
if (*p == '/') \ if (*p == '/') \
after_dir = p + 1; \ after_dir = p + 1; \
fprintf (FILE, "\t.file \"%s\"\n", after_dir); \ fprintf (FILE, "\t.file "); \
output_quoted_string (FILE, after_dir); \
fprintf (FILE, "\n"); \
fprintf (FILE, "\t.sect .lit,lit\n"); } fprintf (FILE, "\t.sect .lit,lit\n"); }
/* Output to assembler file text saying following lines /* Output to assembler file text saying following lines
......
...@@ -61,7 +61,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -61,7 +61,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
for (p = main_input_filename; *p; p++) \ for (p = main_input_filename; *p; p++) \
if (*p == '/') \ if (*p == '/') \
after_dir = p + 1; \ after_dir = p + 1; \
fprintf (FILE, "\t.file \"%s\"\n", after_dir); \ fprintf (FILE, "\t.file "); \
output_quoted_string (FILE, after_dir); \
fprintf (FILE, "\n"); \
if (flag_shared_data) \ if (flag_shared_data) \
fprintf (FILE, "\t.sect .shdata,data\n"); \ fprintf (FILE, "\t.sect .shdata,data\n"); \
fprintf (FILE, "\t.sect .lit,lit\n"); } fprintf (FILE, "\t.sect .lit,lit\n"); }
......
...@@ -1354,7 +1354,9 @@ extern char *current_function_name; ...@@ -1354,7 +1354,9 @@ extern char *current_function_name;
for (p = main_input_filename; *p; p++) \ for (p = main_input_filename; *p; p++) \
if (*p == '/') \ if (*p == '/') \
after_dir = p + 1; \ after_dir = p + 1; \
fprintf (FILE, "\n\t.file 2 \"%s\"\n", after_dir); \ fprintf (FILE, "\n\t.file 2 "); \
output_quoted_string (FILE, after_dir); \
fprintf (FILE, "\n"); \
} }
/* Output to assembler file text saying following lines /* Output to assembler file text saying following lines
......
...@@ -57,7 +57,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -57,7 +57,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef ASM_FILE_START #undef ASM_FILE_START
#define ASM_FILE_START(FILE) \ #define ASM_FILE_START(FILE) \
do { fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name); \ do { fprintf (FILE, "\t.file\t"); \
output_quoted_string (FILE, dump_base_name); \
fprintf (FILE, "\n"); \
if (optimize) \ if (optimize) \
ASM_FILE_START_1 (FILE); \ ASM_FILE_START_1 (FILE); \
else \ else \
......
...@@ -48,7 +48,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -48,7 +48,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
??? I am skeptical of this -- RMS. */ ??? I am skeptical of this -- RMS. */
#define ASM_FILE_START(FILE) \ #define ASM_FILE_START(FILE) \
fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name); do { fprintf (FILE, "\t.file\t"); \
output_quoted_string (FILE, dump_base_name); \
fprintf (FILE, "\n"); \
} while (0)
/* This was suggested, but it shouldn't be right for DBX output. -- RMS /* This was suggested, but it shouldn't be right for DBX output. -- RMS
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */ #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
......
...@@ -93,19 +93,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -93,19 +93,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
fprintf ((FILE), "\t.align 2,0x90\n"); /* Use log of 4 as arg. */ fprintf ((FILE), "\t.align 2,0x90\n"); /* Use log of 4 as arg. */
#undef ASM_FILE_START #undef ASM_FILE_START
/* ASM_FILE_START(FILE) used to be defined as:
fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name);
However, the string dump_base_name may contain backslashes. (This may often
be the case when gcc is run under operating systems such as DOS and OS/2.)
Each backslash in dump_base_name must be converted to two consecutive
backslashes on output. */
#define ASM_FILE_START(FILE) \ #define ASM_FILE_START(FILE) \
{ char *p; \ do { fprintf (FILE, "\t.file\t"); \
fprintf (FILE, "\t.file\t\""); \ output_quoted_string (FILE, dump_base_name); \
for (p = dump_base_name; *p != '\0'; p++) \ fprintf (FILE, "\n"); \
if (*p == '\\') fprintf (FILE, "\\\\"); \ } while (0)
else fprintf (FILE, "%c", *p); \
fprintf (FILE, "\"\n"); }
/* A C statement or statements which output an assembler instruction /* A C statement or statements which output an assembler instruction
opcode to the stdio stream STREAM. The macro-operand PTR is a opcode to the stdio stream STREAM. The macro-operand PTR is a
......
...@@ -70,7 +70,9 @@ do \ ...@@ -70,7 +70,9 @@ do \
} \ } \
strncpy (shorter, na, 14); \ strncpy (shorter, na, 14); \
shorter[14] = 0; \ shorter[14] = 0; \
fprintf (FILE, "\t.file\t\"%s\"\n", shorter); \ fprintf (FILE, "\t.file\t"); \
output_quoted_string (FILE, shorter); \
fprintf (FILE, "\n"); \
} \ } \
fprintf (FILE, "\t.version\t\"%s %s\"\n", \ fprintf (FILE, "\t.version\t\"%s %s\"\n", \
language_string, version_string); \ language_string, version_string); \
......
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