+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.
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"); }
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. */
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,
#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
#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:
#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
/* 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 ""
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 (); \
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;
}
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
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 *));