diff options
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/config/1750a/1750a.h | 4 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 5 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 5 | ||||
-rw-r--r-- | gcc/config/i386/mingw32.h | 42 | ||||
-rw-r--r-- | gcc/config/m68k/dpx2.h | 6 | ||||
-rw-r--r-- | gcc/config/m88k/m88k.h | 6 | ||||
-rw-r--r-- | gcc/config/pj/pj.h | 11 | ||||
-rw-r--r-- | gcc/config/rs6000/xcoff.h | 4 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 6 | ||||
-rw-r--r-- | gcc/toplev.c | 21 | ||||
-rw-r--r-- | gcc/toplev.h | 1 |
12 files changed, 97 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a84cf0a9d1b..3b089560e7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2002-05-23 Gabriel Dos Reis <gdr@codesourcery.com> + Zack Weinberg <zack@codesourcery.com> + + * config/i386/mingw32.h (OUTPUT_QUOTED_STRING): Properly output + quoted strings. + * dwarf2out.c (lookup_filename): Properly quote filename in .file + directive in assembly file. + * config/m68k/dpx2.h (ASM_OUTPUT_SOURCE_FILENAME): Likewise. + * config/m88k/m88k.h (ASM_OUTPUT_SOURCE_FILENAME): Likewise. + * config/pj/pj.h (ASM_FILE_START): Likewise. + * config/rs6000/xcoff.h (ASM_FILE_START): Likewise. + * config/avr/avr.c (asm_file_end): Likewise. + * toplev.c (output_quoted_string): Handle possibly signed plain + char. + * toplev.h (output_clean_symbol_name): Declare + * toplev.c (output_clean_symbol_name): Define. + * config/alpha/alpha.c (unicosmk_output_module_name): Use it. + * config/1750a/1750a.h (ASM_FILE_START): Likewise. + 2002-05-24 Alan Modra <amodra@bigpond.net.au> * config/rs6000/rs6000.c (output_toc): Mask longs to 32 bits. diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h index 77a8fd72906..c6116942077 100644 --- a/gcc/config/1750a/1750a.h +++ b/gcc/config/1750a/1750a.h @@ -833,7 +833,9 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA strcpy(name,p); \ if ((p2 = strchr(name,'.'))) \ *p2 = '\0'; \ - fprintf(FILE,"\tname %s\n",name); \ + fputs ("\tname ", FILE); \ + output_clean_symbol_name (FILE, name); \ + putc ('\n', FILE); \ fprintf(FILE,"\tnolist\n\tinclude \"ms1750.inc\"\n\tlist\n\n"); \ fprintf(FILE,"\tglobal\t__main\n\n"); } diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index dad17844d5f..41cb31e0bea 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -8439,9 +8439,8 @@ unicosmk_output_module_name (file) prefix the module name with a '$' if necessary. */ if (!ISALPHA (*name)) - fprintf (file, "$%s", name); - else - fputs (name, file); + putc ('$', file); + output_clean_symbol_name (file, name); } /* Output text that to appear at the beginning of an assembler file. */ diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index f75de5e8f1a..3ba0eee33a4 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -4801,9 +4801,10 @@ void asm_file_end (file) FILE *file; { + fputs ("/* File ", file); + output_quoted_string (file, main_input_filename); fprintf (file, - "/* File %s: code %4d = 0x%04x (%4d), prologues %3d, epilogues %3d */\n", - main_input_filename, + ": code %4d = 0x%04x (%4d), prologues %3d, epilogues %3d */\n", commands_in_file, commands_in_file, commands_in_file - commands_in_prologues - commands_in_epilogues, diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index ca74c499269..561022c7186 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -85,25 +85,31 @@ Boston, MA 02111-1307, USA. */ #define MATH_LIBRARY "" /* Output STRING, a string representing a filename, to FILE. - We canonicalize it to be in MS-DOS format. */ + We canonicalize it to be in Unix format (backslashe are replaced + forward slashes. */ #undef OUTPUT_QUOTED_STRING -#define OUTPUT_QUOTED_STRING(FILE, STRING) \ -do { \ - char c; \ - \ - putc ('\"', asm_file); \ - \ - while ((c = *string++) != 0) \ - { \ - if (c == '\\') \ - c = '/'; \ - \ - if (c == '\"') \ - putc ('\\', asm_file); \ - putc (c, asm_file); \ - } \ - \ - putc ('\"', asm_file); \ +#define OUTPUT_QUOTED_STRING(FILE, STRING) \ +do { \ + char c; \ + \ + putc ('\"', asm_file); \ + \ + while ((c = *string++) != 0) \ + { \ + if (c == '\\') \ + c = '/'; \ + \ + if (ISPRINT (c)) \ + { \ + if (c == '\"') \ + putc ('\\', asm_file); \ + putc (c, asm_file); \ + } \ + else \ + fprintf (asm_file, "\\%03o", (unsigned char) c); \ + } \ + \ + putc ('\"', asm_file); \ } while (0) /* Override Cygwin's definition. This is necessary now due to the way diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h index 4e540b89ee0..0686b736065 100644 --- a/gcc/config/m68k/dpx2.h +++ b/gcc/config/m68k/dpx2.h @@ -113,7 +113,11 @@ Boston, MA 02111-1307, USA. */ #undef ASM_OUTPUT_SOURCE_FILENAME #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NA) \ - do { fprintf ((FILE), "\t.file\t'%s'\n", (NA)); } while (0) + do { \ + fprintf (FILE, "\t.file\t"); \ + output_quoted_string (FILE, NA); \ + putc ('\n', FILE); \ + } while (0) /* * we don't seem to support any of: diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 172c2d661cf..38bc2e0a629 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1740,7 +1740,11 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, #undef ASM_FILE_END #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) \ - fprintf (FILE, "%s\"%s\"\n", FILE_ASM_OP, NAME) + do { \ + fprintf (FILE_ASM_OP, FILE); \ + output_quoted_string (FILE, NAME); \ + putc ('\n', FILE); \ + } while (0) #ifdef SDB_DEBUGGING_INFO #undef ASM_OUTPUT_SOURCE_LINE diff --git a/gcc/config/pj/pj.h b/gcc/config/pj/pj.h index 294f2fea983..4167973c2c8 100644 --- a/gcc/config/pj/pj.h +++ b/gcc/config/pj/pj.h @@ -1017,10 +1017,13 @@ struct pj_args /* The text to go at the start of the assembler file. */ #undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - fprintf (FILE,"\t.file\t\"%s\"\n", main_input_filename); \ - fprintf (FILE,"\t! %s\n", TARGET_LITTLE_ENDIAN ? ".little" : ".big"); \ - fprintf (FILE,"\t.align 4\n"); +#define ASM_FILE_START(FILE) \ + do { \ + fputs ("\t.file\t", FILE); \ + output_quoted_string (FILE, main_input_filename); \ + fprintf (FILE,"\t! %s\n", TARGET_LITTLE_ENDIAN ? ".little" : ".big"); \ + fprintf (FILE,"\t.align 4\n"); \ + } while (0) #define ASM_APP_ON "" #define ASM_APP_OFF "" diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 2c392439f22..45c7054963f 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -221,7 +221,9 @@ toc_section () \ rs6000_gen_section_name (&xcoff_read_only_section_name, \ main_input_filename, ".ro_"); \ \ - fprintf (FILE, "\t.file\t\"%s\"\n", main_input_filename); \ + fputs ("\t.file\t", FILE); \ + output_quoted_string (FILE, main_input_filename); \ + fputc ('\n', FILE); \ if (TARGET_64BIT) \ fputs ("\t.machine\t\"ppc64\"\n", FILE); \ toc_section (); \ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2fa9f64817e..31daf427069 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -11826,7 +11826,11 @@ lookup_filename (file_name) file_table.last_lookup_index = i; if (DWARF2_ASM_LINE_DEBUG_INFO) - fprintf (asm_out_file, "\t.file %u \"%s\"\n", i, file_name); + { + fprintf (asm_out_file, "\t.file %u ", i); + output_quoted_string (asm_out_file, file_name); + fputc ('\n', asm_out_file); + } return i; } diff --git a/gcc/toplev.c b/gcc/toplev.c index 9c470025c37..13dc17d367e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1704,12 +1704,31 @@ output_quoted_string (asm_file, string) putc (c, asm_file); } else - fprintf (asm_file, "\\%03o", c); + fprintf (asm_file, "\\%03o", (unsigned char) c); } putc ('\"', asm_file); #endif } +/* Output NAME into FILE after having turned it into something + usable as an identifier in a target's assembly file. */ +void +output_clean_symbol_name (file, name) + FILE *file; + const char *name; +{ + /* Make a copy of NAME. */ + char *id = (char *)xmalloc (strlen (name) + 1); + strcpy (id, name); + + /* Make it look like a valid identifier for an assembler. */ + clean_symbol_name (id); + + fputs (file, name); + free (id); +} + + /* Output a file name in the form wanted by System V. */ void diff --git a/gcc/toplev.h b/gcc/toplev.h index 04477c0a014..4be8099efe2 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -89,6 +89,7 @@ extern void warning_for_asm PARAMS ((struct rtx_def *, const char *, ...)); extern void warn_deprecated_use PARAMS ((union tree_node *)); +extern void output_clean_symbol_name PARAMS ((FILE *, const char *)); #ifdef BUFSIZ extern void output_quoted_string PARAMS ((FILE *, const char *)); extern void output_file_directive PARAMS ((FILE *, const char *)); |