mingw32.h (OUTPUT_QUOTED_STRING): Properly output quoted strings.

* 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.

Co-Authored-By: Zack Weinberg <zack@codesourcery.com>

From-SVN: r53817
This commit is contained in:
Gabriel Dos Reis 2002-05-23 23:37:09 +00:00 committed by Mark Mitchell
parent 2f0552b6d0
commit 211a0cbe13
12 changed files with 97 additions and 33 deletions

View File

@ -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.

View File

@ -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"); }

View File

@ -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. */

View File

@ -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,

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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 ""

View File

@ -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 (); \

View File

@ -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;
}

View File

@ -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

View File

@ -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 *));