final.c (output_operand_lossage): Changed to accept printf style arguments.

2002-02-17  Philipp Thomas  <pthomas@suse.de>

	* final.c (output_operand_lossage): Changed to accept
	printf style arguments. Change calls where necessary.
	* output.h (output_operand_lossage): Change declaration
	accordingly. Update copyright.
	* config/arc/arc.c config/fr30/fr30.c config/m32r/m32r.c
	config/m88k/m88k.c : Adapt all calls to output_operand_lossage.
	Update copyright date where necessary.

	* config/i386/i386.c (print_operand): Likewise. Remove use of
	sprintf.

	* config/cris/cris.c (cris_operand_lossage): Likewise.
	Rename parameter so that exgettext recognizes it as
	translatable message.
	(LOSE_AND_RETURN): Rename parameter to msgid.

	* po/gcc.pot: Regenerate.

From-SVN: r49820
This commit is contained in:
Philipp Thomas 2002-02-17 14:23:53 +00:00 committed by Philipp Thomas
parent 1c11abc46f
commit a52453cc42
11 changed files with 1216 additions and 2397 deletions

View File

@ -1,3 +1,21 @@
2002-02-17 Philipp Thomas <pthomas@suse.de>
* final.c (output_operand_lossage): Changed to accept
printf style arguments. Change calls where necessary.
* output.h (output_operand_lossage): Change declaration
accordingly. Update copyright.
* config/arc/arc.c config/fr30/fr30.c config/m32r/m32r.c
config/m88k/m88k.c : Adapt all calls to output_operand_lossage.
Update copyright date where necessary.
* config/i386/i386.c (print_operand): Likewise. Remove use of
sprintf.
* config/cris/cris.c (cris_operand_lossage): Likewise.
Rename parameter so that exgettext recognizes it as
translatable message.
(LOSE_AND_RETURN): Rename parameter to msgid.
2002-02-17 Kazu Hirata <kazu@hxi.com> 2002-02-17 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.h (CONDITIONAL_REGISTER_USAGE): Replace a * config/h8300/h8300.h (CONDITIONAL_REGISTER_USAGE): Replace a

View File

@ -1,5 +1,5 @@
/* Subroutines used for code generation on the Argonaut ARC cpu. /* Subroutines used for code generation on the Argonaut ARC cpu.
Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
@ -1706,7 +1706,7 @@ arc_print_operand (file, x, code)
fputc (']', file); fputc (']', file);
} }
else else
output_operand_lossage ("invalid operand to %R code"); output_operand_lossage ("invalid operand to %%R code");
return; return;
case 'S' : case 'S' :
if ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FLAG (x)) if ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FLAG (x))
@ -1738,7 +1738,7 @@ arc_print_operand (file, x, code)
(long)(code == 'L' ? INTVAL (first) : INTVAL (second))); (long)(code == 'L' ? INTVAL (first) : INTVAL (second)));
} }
else else
output_operand_lossage ("invalid operand to %H/%L code"); output_operand_lossage ("invalid operand to %%H/%%L code");
return; return;
case 'A' : case 'A' :
{ {
@ -1762,7 +1762,7 @@ arc_print_operand (file, x, code)
fputs (".a", file); fputs (".a", file);
} }
else else
output_operand_lossage ("invalid operand to %U code"); output_operand_lossage ("invalid operand to %%U code");
return; return;
case 'V' : case 'V' :
/* Output cache bypass indicator for a load/store insn. Volatile memory /* Output cache bypass indicator for a load/store insn. Volatile memory
@ -1773,7 +1773,7 @@ arc_print_operand (file, x, code)
fputs (".di", file); fputs (".di", file);
} }
else else
output_operand_lossage ("invalid operand to %V code"); output_operand_lossage ("invalid operand to %%V code");
return; return;
case 0 : case 0 :
/* Do nothing special. */ /* Do nothing special. */

View File

@ -55,10 +55,10 @@ Boston, MA 02111-1307, USA. */
abort (); \ abort (); \
} while (0) } while (0)
#define LOSE_AND_RETURN(msg, x) \ #define LOSE_AND_RETURN(msgid, x) \
do \ do \
{ \ { \
cris_operand_lossage (msg, x); \ cris_operand_lossage (msgid, x); \
return; \ return; \
} while (0) } while (0)
@ -507,12 +507,12 @@ cris_op_str (x)
categorization of the error. */ categorization of the error. */
static void static void
cris_operand_lossage (msg, op) cris_operand_lossage (msgid, op)
const char *msg; const char *msgid;
rtx op; rtx op;
{ {
debug_rtx (op); debug_rtx (op);
output_operand_lossage (msg); output_operand_lossage ("%s", msgid);
} }
/* Print an index part of an address to file. */ /* Print an index part of an address to file. */

View File

@ -1,5 +1,5 @@
/* FR30 specific functions. /* FR30 specific functions.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Cygnus Solutions. Contributed by Cygnus Solutions.
This file is part of GNU CC. This file is part of GNU CC.
@ -480,7 +480,7 @@ fr30_print_operand (file, x, code)
/* Compute the register name of the second register in a hi/lo /* Compute the register name of the second register in a hi/lo
register pair. */ register pair. */
if (GET_CODE (x) != REG) if (GET_CODE (x) != REG)
output_operand_lossage ("fr30_print_operand: unrecognized %p code"); output_operand_lossage ("fr30_print_operand: unrecognized %%p code");
else else
fprintf (file, "r%d", REGNO (x) + 1); fprintf (file, "r%d", REGNO (x) + 1);
return; return;
@ -500,7 +500,7 @@ fr30_print_operand (file, x, code)
case GTU: fprintf (file, "hi"); break; case GTU: fprintf (file, "hi"); break;
case GEU: fprintf (file, "nc"); break; case GEU: fprintf (file, "nc"); break;
default: default:
output_operand_lossage ("fr30_print_operand: unrecognized %b code"); output_operand_lossage ("fr30_print_operand: unrecognized %%b code");
break; break;
} }
return; return;
@ -521,7 +521,7 @@ fr30_print_operand (file, x, code)
case GTU: fprintf (file, "ls"); break; case GTU: fprintf (file, "ls"); break;
case GEU: fprintf (file, "c"); break; case GEU: fprintf (file, "c"); break;
default: default:
output_operand_lossage ("fr30_print_operand: unrecognized %B code"); output_operand_lossage ("fr30_print_operand: unrecognized %%B code");
break; break;
} }
return; return;
@ -529,7 +529,7 @@ fr30_print_operand (file, x, code)
case 'A': case 'A':
/* Print a signed byte value as an unsigned value. */ /* Print a signed byte value as an unsigned value. */
if (GET_CODE (x) != CONST_INT) if (GET_CODE (x) != CONST_INT)
output_operand_lossage ("fr30_print_operand: invalid operand to %A code"); output_operand_lossage ("fr30_print_operand: invalid operand to %%A code");
else else
{ {
HOST_WIDE_INT val; HOST_WIDE_INT val;
@ -546,14 +546,14 @@ fr30_print_operand (file, x, code)
if (GET_CODE (x) != CONST_INT if (GET_CODE (x) != CONST_INT
|| INTVAL (x) < 16 || INTVAL (x) < 16
|| INTVAL (x) > 32) || INTVAL (x) > 32)
output_operand_lossage ("fr30_print_operand: invalid %x code"); output_operand_lossage ("fr30_print_operand: invalid %%x code");
else else
fprintf (file, "%d", INTVAL (x) - 16); fprintf (file, "%d", INTVAL (x) - 16);
return; return;
case 'F': case 'F':
if (GET_CODE (x) != CONST_DOUBLE) if (GET_CODE (x) != CONST_DOUBLE)
output_operand_lossage ("fr30_print_operand: invalid %F code"); output_operand_lossage ("fr30_print_operand: invalid %%F code");
else else
{ {
REAL_VALUE_TYPE d; REAL_VALUE_TYPE d;

View File

@ -5862,11 +5862,7 @@ print_operand (file, x, code)
return; return;
} }
default: default:
{ output_operand_lossage ("invalid operand code `%c'", code);
char str[50];
sprintf (str, "invalid operand code `%c'", code);
output_operand_lossage (str);
}
} }
} }

View File

@ -1,5 +1,5 @@
/* Subroutines used for code generation on the Mitsubishi M32R cpu. /* Subroutines used for code generation on the Mitsubishi M32R cpu.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
@ -2245,14 +2245,14 @@ m32r_print_operand (file, x, code)
if (GET_CODE (x) == REG) if (GET_CODE (x) == REG)
fprintf (file, "@+%s", reg_names [REGNO (x)]); fprintf (file, "@+%s", reg_names [REGNO (x)]);
else else
output_operand_lossage ("invalid operand to %s code"); output_operand_lossage ("invalid operand to %%s code");
return; return;
case 'p': case 'p':
if (GET_CODE (x) == REG) if (GET_CODE (x) == REG)
fprintf (file, "@%s+", reg_names [REGNO (x)]); fprintf (file, "@%s+", reg_names [REGNO (x)]);
else else
output_operand_lossage ("invalid operand to %p code"); output_operand_lossage ("invalid operand to %%p code");
return; return;
case 'R' : case 'R' :
@ -2275,7 +2275,7 @@ m32r_print_operand (file, x, code)
fputc (')', file); fputc (')', file);
} }
else else
output_operand_lossage ("invalid operand to %R code"); output_operand_lossage ("invalid operand to %%R code");
return; return;
case 'H' : /* High word */ case 'H' : /* High word */
@ -2298,7 +2298,7 @@ m32r_print_operand (file, x, code)
code == 'L' ? INTVAL (first) : INTVAL (second)); code == 'L' ? INTVAL (first) : INTVAL (second));
} }
else else
output_operand_lossage ("invalid operand to %H/%L code"); output_operand_lossage ("invalid operand to %%H/%%L code");
return; return;
case 'A' : case 'A' :
@ -2360,7 +2360,7 @@ m32r_print_operand (file, x, code)
fputc (')', file); fputc (')', file);
return; return;
default : default :
output_operand_lossage ("invalid operand to %T/%B code"); output_operand_lossage ("invalid operand to %%T/%%B code");
return; return;
} }
break; break;
@ -2375,7 +2375,7 @@ m32r_print_operand (file, x, code)
fputs (".a", file); fputs (".a", file);
} }
else else
output_operand_lossage ("invalid operand to %U code"); output_operand_lossage ("invalid operand to %%U code");
return; return;
case 'N' : case 'N' :
@ -2383,7 +2383,7 @@ m32r_print_operand (file, x, code)
if (GET_CODE (x) == CONST_INT) if (GET_CODE (x) == CONST_INT)
output_addr_const (file, GEN_INT (- INTVAL (x))); output_addr_const (file, GEN_INT (- INTVAL (x)));
else else
output_operand_lossage ("invalid operand to %N code"); output_operand_lossage ("invalid operand to %%N code");
return; return;
case 'X' : case 'X' :

View File

@ -2879,7 +2879,7 @@ print_operand (file, x, code)
if (sequencep) if (sequencep)
{ {
if (code < 'B' || code > 'E') if (code < 'B' || code > 'E')
output_operand_lossage ("%R not followed by %B/C/D/E"); output_operand_lossage ("%%R not followed by %%B/C/D/E");
if (reversep) if (reversep)
xc = reverse_condition (xc); xc = reverse_condition (xc);
sequencep = 0; sequencep = 0;
@ -2947,43 +2947,43 @@ print_operand (file, x, code)
value >>= 16; value >>= 16;
case 'x': /* print the lower 16 bits of the integer constant in hex */ case 'x': /* print the lower 16 bits of the integer constant in hex */
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %x/X value"); output_operand_lossage ("invalid %%x/X value");
fprintf (file, "0x%x", value & 0xffff); return; fprintf (file, "0x%x", value & 0xffff); return;
case 'H': /* print the low 16 bits of the negated integer constant */ case 'H': /* print the low 16 bits of the negated integer constant */
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %H value"); output_operand_lossage ("invalid %%H value");
value = -value; value = -value;
case 'h': /* print the register or low 16 bits of the integer constant */ case 'h': /* print the register or low 16 bits of the integer constant */
if (xc == REG) if (xc == REG)
goto reg; goto reg;
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %h value"); output_operand_lossage ("invalid %%h value");
fprintf (file, "%d", value & 0xffff); fprintf (file, "%d", value & 0xffff);
return; return;
case 'Q': /* print the low 8 bits of the negated integer constant */ case 'Q': /* print the low 8 bits of the negated integer constant */
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %Q value"); output_operand_lossage ("invalid %%Q value");
value = -value; value = -value;
case 'q': /* print the register or low 8 bits of the integer constant */ case 'q': /* print the register or low 8 bits of the integer constant */
if (xc == REG) if (xc == REG)
goto reg; goto reg;
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %q value"); output_operand_lossage ("invalid %%q value");
fprintf (file, "%d", value & 0xff); fprintf (file, "%d", value & 0xff);
return; return;
case 'w': /* print the integer constant (X == 32 ? 0 : 32 - X) */ case 'w': /* print the integer constant (X == 32 ? 0 : 32 - X) */
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %o value"); output_operand_lossage ("invalid %%o value");
fprintf (file, "%d", value == 32 ? 0 : 32 - value); fprintf (file, "%d", value == 32 ? 0 : 32 - value);
return; return;
case 'p': /* print the logarithm of the integer constant */ case 'p': /* print the logarithm of the integer constant */
if (xc != CONST_INT if (xc != CONST_INT
|| (value = exact_log2 (value)) < 0) || (value = exact_log2 (value)) < 0)
output_operand_lossage ("invalid %p value"); output_operand_lossage ("invalid %%p value");
fprintf (file, "%d", value); fprintf (file, "%d", value);
return; return;
@ -2996,12 +2996,12 @@ print_operand (file, x, code)
register int top, bottom; register int top, bottom;
if (xc != CONST_INT) if (xc != CONST_INT)
output_operand_lossage ("invalid %s/S value"); output_operand_lossage ("invalid %%s/S value");
/* All the "one" bits must be contiguous. If so, MASK will be /* All the "one" bits must be contiguous. If so, MASK will be
a power of two or zero. */ a power of two or zero. */
mask = (uval | (uval - 1)) + 1; mask = (uval | (uval - 1)) + 1;
if (!(uval && POWER_OF_2_or_0 (mask))) if (!(uval && POWER_OF_2_or_0 (mask)))
output_operand_lossage ("invalid %s/S value"); output_operand_lossage ("invalid %%s/S value");
top = mask ? exact_log2 (mask) : 32; top = mask ? exact_log2 (mask) : 32;
bottom = exact_log2 (uval & ~(uval - 1)); bottom = exact_log2 (uval & ~(uval - 1));
fprintf (file,"%d<%d>", top - bottom, bottom); fprintf (file,"%d<%d>", top - bottom, bottom);
@ -3012,7 +3012,7 @@ print_operand (file, x, code)
if (xc == LABEL_REF) if (xc == LABEL_REF)
output_addr_const (file, x); output_addr_const (file, x);
else if (xc != PC) else if (xc != PC)
output_operand_lossage ("invalid %P operand"); output_operand_lossage ("invalid %%P operand");
return; return;
case 'L': /* print 0 or 1 if operand is label_ref and then... */ case 'L': /* print 0 or 1 if operand is label_ref and then... */
@ -3043,7 +3043,7 @@ print_operand (file, x, code)
case LE: fputs ("le0", file); return; case LE: fputs ("le0", file); return;
case LT: fputs ("lt0", file); return; case LT: fputs ("lt0", file); return;
case GE: fputs ("ge0", file); return; case GE: fputs ("ge0", file); return;
default: output_operand_lossage ("invalid %B value"); default: output_operand_lossage ("invalid %%B value");
} }
case 'C': /* bb0/bb1 branch values for comparisons */ case 'C': /* bb0/bb1 branch values for comparisons */
@ -3060,7 +3060,7 @@ print_operand (file, x, code)
case LEU: fputs ("ls", file); return; case LEU: fputs ("ls", file); return;
case LTU: fputs ("lo", file); return; case LTU: fputs ("lo", file); return;
case GEU: fputs ("hs", file); return; case GEU: fputs ("hs", file); return;
default: output_operand_lossage ("invalid %C value"); default: output_operand_lossage ("invalid %%C value");
} }
case 'D': /* bcnd branch values for float comparisons */ case 'D': /* bcnd branch values for float comparisons */
@ -3073,7 +3073,7 @@ print_operand (file, x, code)
case LE: fputs ("0xe", file); return; case LE: fputs ("0xe", file); return;
case LT: fputs ("0x4", file); return; case LT: fputs ("0x4", file); return;
case GE: fputs ("0xb", file); return; case GE: fputs ("0xb", file); return;
default: output_operand_lossage ("invalid %D value"); default: output_operand_lossage ("invalid %%D value");
} }
case 'E': /* bcnd branch values for special integers */ case 'E': /* bcnd branch values for special integers */
@ -3081,12 +3081,12 @@ print_operand (file, x, code)
{ {
case EQ: fputs ("0x8", file); return; case EQ: fputs ("0x8", file); return;
case NE: fputs ("0x7", file); return; case NE: fputs ("0x7", file); return;
default: output_operand_lossage ("invalid %E value"); default: output_operand_lossage ("invalid %%E value");
} }
case 'd': /* second register of a two register pair */ case 'd': /* second register of a two register pair */
if (xc != REG) if (xc != REG)
output_operand_lossage ("`%d' operand isn't a register"); output_operand_lossage ("`%%d' operand isn't a register");
fputs (reg_names[REGNO (x) + 1], file); fputs (reg_names[REGNO (x) + 1], file);
return; return;
@ -3097,7 +3097,7 @@ print_operand (file, x, code)
return; return;
} }
else if (xc != REG) else if (xc != REG)
output_operand_lossage ("invalid %r value"); output_operand_lossage ("invalid %%r value");
case 0: case 0:
name: name:
if (xc == REG) if (xc == REG)

View File

@ -2965,13 +2965,26 @@ alter_cond (cond)
In an `asm', it's the user's fault; otherwise, the compiler's fault. */ In an `asm', it's the user's fault; otherwise, the compiler's fault. */
void void
output_operand_lossage (msgid) output_operand_lossage VPARAMS ((const char *msgid, ...))
const char *msgid;
{ {
char *fmt_string;
char *new_message;
char *pfx_str;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
pfx_str = this_is_asm_operands ? _("invalid `asm': ") : "output_operand: ";
asprintf (&fmt_string, "%s%s", pfx_str, _(msgid));
vasprintf (&new_message, fmt_string, ap);
if (this_is_asm_operands) if (this_is_asm_operands)
error_for_asm (this_is_asm_operands, "invalid `asm': %s", _(msgid)); error_for_asm (this_is_asm_operands, "%s", new_message);
else else
internal_error ("output_operand: %s", _(msgid)); internal_error ("%s", new_message);
free (fmt_string);
free (new_message);
VA_CLOSE (ap);
} }
/* Output of assembler code from a template, and its subroutines. */ /* Output of assembler code from a template, and its subroutines. */
@ -3217,7 +3230,7 @@ output_asm_insn (template, operands)
c = atoi (p); c = atoi (p);
if (! ISDIGIT (*p)) if (! ISDIGIT (*p))
output_operand_lossage ("operand number missing after %-letter"); output_operand_lossage ("operand number missing after %%-letter");
else if (this_is_asm_operands else if (this_is_asm_operands
&& (c < 0 || (unsigned int) c >= insn_noperands)) && (c < 0 || (unsigned int) c >= insn_noperands))
output_operand_lossage ("operand number out of range"); output_operand_lossage ("operand number out of range");
@ -3309,7 +3322,7 @@ output_asm_label (x)
&& NOTE_LINE_NUMBER (x) == NOTE_INSN_DELETED_LABEL)) && NOTE_LINE_NUMBER (x) == NOTE_INSN_DELETED_LABEL))
ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x)); ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
else else
output_operand_lossage ("`%l' operand isn't a label"); output_operand_lossage ("`%%l' operand isn't a label");
assemble_name (asm_out_file, buf); assemble_name (asm_out_file, buf);
} }

View File

@ -1,7 +1,7 @@
/* Declarations for insn-output.c. These functions are defined in recog.c, /* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c. final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998, Copyright (C) 1987, 1991, 1994, 1997, 1998,
1999, 2000, 2001 Free Software Foundation, Inc. 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
@ -81,7 +81,7 @@ extern rtx alter_subreg PARAMS ((rtx *));
/* Report inconsistency between the assembler template and the operands. /* Report inconsistency between the assembler template and the operands.
In an `asm', it's the user's fault; otherwise, the compiler's fault. */ In an `asm', it's the user's fault; otherwise, the compiler's fault. */
extern void output_operand_lossage PARAMS ((const char *)); extern void output_operand_lossage PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
/* Output a string of assembler code, substituting insn operands. /* Output a string of assembler code, substituting insn operands.
Defined in final.c. */ Defined in final.c. */

View File

@ -1,3 +1,7 @@
2002-02-17 Philipp Thomas <pthomas@suse.de>
* gcc.pot: Regenerate.
2002-02-11 Zack Weinberg <zack@codesourcery.com> 2002-02-11 Zack Weinberg <zack@codesourcery.com>
* gcc.pot: Regenerate. * gcc.pot: Regenerate.

File diff suppressed because it is too large Load Diff