From: Andrew Cagney Date: Sat, 2 Feb 2002 02:28:40 +0000 (+0000) Subject: * language.h (type_error, range_error): Make string parameter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ddfe3c15876eb717dbdc16cb79c4c20340d7443e;p=binutils-gdb.git * language.h (type_error, range_error): Make string parameter constant. * language.c (warning_pre_print): Delete extern declaration. * dwarfread.c (warning_pre_print): Ditto. * language.c (type_error, range_error): Rewrite to use verror and vwarning instead of warning_begin. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5870e8104c9..7d8f9c6d57f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-02-01 Andrew Cagney + + * language.h (type_error, range_error): Make string parameter + constant. + * language.c (warning_pre_print): Delete extern declaration. + * dwarfread.c (warning_pre_print): Ditto. + * language.c (type_error, range_error): Rewrite to use verror and + vwarning instead of warning_begin. + 2002-02-01 Michael Snyder * breakpoint.c (set_ignore_count): Move misplaced comment diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 3fdfd1ce375..d5a62cce2ba 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -239,10 +239,6 @@ typedef unsigned int DIE_REF; /* Reference to a DIE */ #define AT_short_element_list (0x00f0|FORM_BLOCK2) -/* External variables referenced. */ - -extern char *warning_pre_print; /* From utils.c */ - /* The DWARF debugging information consists of two major pieces, one is a block of DWARF Information Entries (DIE's) and the other is a line number table. The "struct dieinfo" structure contains diff --git a/gdb/language.c b/gdb/language.c index f8525b6843d..c2db91cd301 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -100,7 +100,6 @@ static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val /* Forward declaration */ extern const struct language_defn unknown_language_defn; -extern char *warning_pre_print; /* The current (default at startup) state of type and range checking. (If the modes are set to "auto", though, these are changed based @@ -1234,47 +1233,63 @@ op_error (char *fmt, enum exp_opcode op, int fatal) } } -/* These are called when a language fails a type- or range-check. - The first argument should be a printf()-style format string, and - the rest of the arguments should be its arguments. If - [type|range]_check is [type|range]_check_on, then return_to_top_level() - is called in the style of error (). Otherwise, the message is prefixed - by the value of warning_pre_print and we do not return to the top level. */ +/* These are called when a language fails a type- or range-check. The + first argument should be a printf()-style format string, and the + rest of the arguments should be its arguments. If + [type|range]_check is [type|range]_check_on, an error is printed; + if [type|range]_check_warn, a warning; otherwise just the + message. */ void -type_error (char *string,...) +type_error (const char *string,...) { va_list args; va_start (args, string); - if (type_check == type_check_warn) - fprintf_filtered (gdb_stderr, warning_pre_print); - else - error_begin (); - - vfprintf_filtered (gdb_stderr, string, args); - fprintf_filtered (gdb_stderr, "\n"); + switch (type_check) + { + case type_check_warn: + vwarning (string, args); + break; + case type_check_on: + verror (string, args); + break; + case type_check_off: + /* FIXME: cagney/2002-01-30: Should this function print anything + when type error is off? */ + vfprintf_filtered (gdb_stderr, string, args); + fprintf_filtered (gdb_stderr, "\n"); + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); + } va_end (args); - if (type_check == type_check_on) - return_to_top_level (RETURN_ERROR); } void -range_error (char *string,...) +range_error (const char *string,...) { va_list args; va_start (args, string); - if (range_check == range_check_warn) - fprintf_filtered (gdb_stderr, warning_pre_print); - else - error_begin (); - - vfprintf_filtered (gdb_stderr, string, args); - fprintf_filtered (gdb_stderr, "\n"); + switch (range_check) + { + case range_check_warn: + vwarning (string, args); + break; + case range_check_on: + verror (string, args); + break; + case range_check_off: + /* FIXME: cagney/2002-01-30: Should this function print anything + when range error is off? */ + vfprintf_filtered (gdb_stderr, string, args); + fprintf_filtered (gdb_stderr, "\n"); + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); + } va_end (args); - if (range_check == range_check_on) - return_to_top_level (RETURN_ERROR); } diff --git a/gdb/language.h b/gdb/language.h index 01d75bd9618..88375db268a 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -440,11 +440,9 @@ extern void op_error (char *fmt, enum exp_opcode, int); #define range_op_error(f,o) \ op_error((f),(o),range_check==range_check_on ? 1 : 0) -extern void type_error (char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void type_error (const char *, ...) ATTR_FORMAT (printf, 1, 2); -void -range_error (char *, ...) -ATTR_FORMAT (printf, 1, 2); +extern void range_error (const char *, ...) ATTR_FORMAT (printf, 1, 2); /* Data: Does this value represent "truth" to the current language? */