diff options
author | Keith Seitz <keiths@redhat.com> | 2012-08-17 17:37:03 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2012-08-17 17:37:03 +0000 |
commit | a451cb65e32f48d8b3cd71806da223c6c105cf94 (patch) | |
tree | 4edbaadee2cb321bf2975ff93b0af87e71adb798 /gdb/language.c | |
parent | 7b458c12dc33fc7af4c67c138feaa5f034351bac (diff) | |
download | gdb-a451cb65e32f48d8b3cd71806da223c6c105cf94.zip gdb-a451cb65e32f48d8b3cd71806da223c6c105cf94.tar.gz gdb-a451cb65e32f48d8b3cd71806da223c6c105cf94.tar.bz2 |
PR c++/13356
* gdbtypes.c (strict_type_checking): New variable.
(show_strict_type_checking): New function.
(rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS
if strict type checking is disabled.
(_initialize_gdbtypes): Add "check type" subcommand.
* gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct.
PR c++/13356
* gdb.base/default.exp: Update all "check type" tests.
* gdb.base/help.exp: Likewise.
* gdb.base/setshow.exp: Likewise.
* gdb.cp/converts.cc (foo1_type_check): New function.
(foo2_type_check): New function.
(foo3_type_check): New function.
(main): Call new functions.
* converts.exp: Add tests for integer-to-pointer conversions
with/without strict type-checking.
PR c++/13356
* gdb.texinfo (Type and Range Checking): Remove warning.
Remove spurious commas.
Update text and examples for re-implementation of set/show
check type.
(C and C++ Type and Range Checks): Likewise.
* language.h (type_mode): Remove.
(type_check): Remove.
(struct language_defn): Remove la_type_check.
(STRICT_TYPE): Remove unused macro.
(type_error): Remove.
* language.c (set_type_range_case): Renamed to ...
(set_range_case): ... this. Update all callers.
Remove type_mode/type_check.
(type_mode): Remove.
(type_check): Remove.
(show_type_command): Remove.
(set_type_command): Remove.
(language_info): Remove type checking output.
(type_error): Remove unused function.
(range_error): Update comment.
(unknown_language_defn): Remove la_type_check.
(auto_language_defn): Likewise.
(local_language_defn): Likewise.
(_initialize_language): Remove "check type" subcommand.
* ada-lang.c (ada_language_defn): Remove la_type_check.
* c-lang.c (c_language_defn): Likewise.
(cplus_language_defn): Likewise.
(asm_language_defn): Likewise.
(minimal_language_defn): Likewise.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Likewise.
* go-lang.c (go_language_defn): Likewise.
* jv-lang.c (java_language_defn): Likewise.
* m2-lang.c (m2_language_defn): Likewise.
* objc-lang.c (objc_language_defn): Likewise.
* opencl-lang.c (opencl_language_defn): Likewise.
* p-lang.c (pascal_language_defn): Likewise.
Diffstat (limited to 'gdb/language.c')
-rw-r--r-- | gdb/language.c | 137 |
1 files changed, 10 insertions, 127 deletions
diff --git a/gdb/language.c b/gdb/language.c index f0a8697..841f2d6 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -55,7 +55,7 @@ static void show_check (char *, int); static void set_check (char *, int); -static void set_type_range_case (void); +static void set_range_case (void); static void unk_lang_emit_char (int c, struct type *type, struct ui_file *stream, int quoter); @@ -81,8 +81,6 @@ extern const struct language_defn unknown_language_defn; enum range_mode range_mode = range_mode_auto; enum range_check range_check = range_check_off; -enum type_mode type_mode = type_mode_auto; -enum type_check type_check = type_check_off; enum case_mode case_mode = case_mode_auto; enum case_sensitivity case_sensitivity = case_sensitive_on; @@ -174,7 +172,7 @@ set_language_command (char *ignore, int from_tty, struct cmd_list_element *c) /* Enter manual mode. Set the specified language. */ language_mode = language_mode_manual; current_language = languages[i]; - set_type_range_case (); + set_range_case (); expected_language = current_language; return; } @@ -186,79 +184,6 @@ set_language_command (char *ignore, int from_tty, struct cmd_list_element *c) language); } -/* Show command. Display a warning if the type setting does - not match the current language. */ -static void -show_type_command (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -{ - if (type_mode == type_mode_auto) - { - char *tmp = NULL; - - switch (type_check) - { - case type_check_on: - tmp = "on"; - break; - case type_check_off: - tmp = "off"; - break; - case type_check_warn: - tmp = "warn"; - break; - default: - internal_error (__FILE__, __LINE__, - "Unrecognized type check setting."); - } - - fprintf_filtered (gdb_stdout, - _("Type checking is \"auto; currently %s\".\n"), - tmp); - } - else - fprintf_filtered (gdb_stdout, _("Type checking is \"%s\".\n"), - value); - - if (type_check != current_language->la_type_check) - warning (_("the current type check setting" - " does not match the language.\n")); -} - -/* Set command. Change the setting for type checking. */ -static void -set_type_command (char *ignore, int from_tty, struct cmd_list_element *c) -{ - if (strcmp (type, "on") == 0) - { - type_check = type_check_on; - type_mode = type_mode_manual; - } - else if (strcmp (type, "warn") == 0) - { - type_check = type_check_warn; - type_mode = type_mode_manual; - } - else if (strcmp (type, "off") == 0) - { - type_check = type_check_off; - type_mode = type_mode_manual; - } - else if (strcmp (type, "auto") == 0) - { - type_mode = type_mode_auto; - set_type_range_case (); - return; - } - else - internal_error (__FILE__, __LINE__, - _("Unrecognized type check setting: \"%s\""), type); - - if (type_check != current_language->la_type_check) - warning (_("the current type check setting" - " does not match the language.\n")); -} - /* Show command. Display a warning if the range setting does not match the current language. */ static void @@ -320,7 +245,7 @@ set_range_command (char *ignore, int from_tty, struct cmd_list_element *c) else if (strcmp (range, "auto") == 0) { range_mode = range_mode_auto; - set_type_range_case (); + set_range_case (); return; } else @@ -389,7 +314,7 @@ set_case_command (char *ignore, int from_tty, struct cmd_list_element *c) else if (strcmp (case_sensitive, "auto") == 0) { case_mode = case_mode_auto; - set_type_range_case (); + set_range_case (); return; } else @@ -409,14 +334,11 @@ set_case_command (char *ignore, int from_tty, struct cmd_list_element *c) If SHOW is non-zero, then print out the current language, type and range checking status. */ static void -set_type_range_case (void) +set_range_case (void) { if (range_mode == range_mode_auto) range_check = current_language->la_range_check; - if (type_mode == type_mode_auto) - type_check = current_language->la_type_check; - if (case_mode == case_mode_auto) case_sensitivity = current_language->la_case_sensitivity; } @@ -437,7 +359,7 @@ set_language (enum language lang) if (languages[i]->la_language == lang) { current_language = languages[i]; - set_type_range_case (); + set_range_case (); break; } } @@ -461,8 +383,6 @@ language_info (int quietly) if (!quietly) { - printf_unfiltered (_("Type checking: %s\n"), type); - show_type_command (NULL, 1, NULL, NULL); printf_unfiltered (_("Range checking: %s\n"), range); show_range_command (NULL, 1, NULL, NULL); printf_unfiltered (_("Case sensitivity: %s\n"), case_sensitive); @@ -500,38 +420,11 @@ value_true (struct value *val) error messages that occur during type- and range- checking. */ -/* These are called when a language fails a type- or range-check. The +/* This is called when a language fails a 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 (const char *string,...) -{ - va_list args; - - va_start (args, string); - 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); -} + rest of the arguments should be its arguments. If range_check is + range_check_on, an error is printed; if range_check_warn, a warning; + otherwise just the message. */ void range_error (const char *string,...) @@ -902,7 +795,6 @@ const struct language_defn unknown_language_defn = "unknown", language_unknown, range_check_off, - type_check_off, case_sensitive_on, array_row_major, macro_expansion_no, @@ -946,7 +838,6 @@ const struct language_defn auto_language_defn = "auto", language_auto, range_check_off, - type_check_off, case_sensitive_on, array_row_major, macro_expansion_no, @@ -988,7 +879,6 @@ const struct language_defn local_language_defn = "local", language_auto, range_check_off, - type_check_off, case_sensitive_on, array_row_major, macro_expansion_no, @@ -1135,13 +1025,6 @@ _initialize_language (void) add_alias_cmd ("c", "check", no_class, 1, &showlist); add_alias_cmd ("ch", "check", no_class, 1, &showlist); - add_setshow_enum_cmd ("type", class_support, type_or_range_names, &type, - _("Set type checking. (on/warn/off/auto)"), - _("Show type checking. (on/warn/off/auto)"), - NULL, set_type_command, - show_type_command, - &setchecklist, &showchecklist); - add_setshow_enum_cmd ("range", class_support, type_or_range_names, &range, _("Set range checking. (on/warn/off/auto)"), |