diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 841e7ea450d..4bc591fb660 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,38 @@ +2012-01-28 Jan Kratochvil + + Code cleanup: Make 1440 bytes of data segment read-only. + * arch-utils.c (endian_enum): Make it const char *const []. + * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): + Likewise. + * breakpoint.c (always_inserted_enums): Likewise. + * cli/cli-cmds.c (script_ext_enums): Likewise. + * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the + enumlist parameter const char *const *. + * cli/cli-decode.h (struct cmd_list_element): Make the enums field + const char *const *. + * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist + parameter const char *const *. + * cris-tdep.c (cris_modes): Make it const char *const []. + * filesystem.c (target_file_system_kinds): Likewise. + * i386-tdep.c (valid_flavors, valid_conventions): Likewise. + * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) + (can_use_displaced_stepping_enum, scheduler_enums) + (exec_direction_names): Likewise. + * language.c (_initialize_language): Make the type_or_range_names and + case_sensitive_names variables const char *const []. + * mips-tdep.c (mips_abi_strings): Make it const char *const []. + * python/python.c (python_excp_enums): Likewise. + * remote.c (interrupt_sequence_modes): Likewise. + * rs6000-tdep.c (powerpc_vector_strings): Likewise. + * serial.c (logbase_enums): Likewise. + * sh-tdep.c (sh_cc_enum): Likewise. + * stack.c (print_frame_arguments_choices, print_entry_values_choices): + Likewise. + * symtab.c (multiple_symbols_modes): Likewise. + * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): + Likewise. + * utils.c (internal_problem_modes): Likewise. + 2012-01-27 Jan Kratochvil Fix the 2012-01-26 regression by la_get_symbol_name_match_p. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 45dccad0599..916a3ef92a8 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -251,7 +251,7 @@ static int target_byte_order_user = BFD_ENDIAN_UNKNOWN; static const char endian_big[] = "big"; static const char endian_little[] = "little"; static const char endian_auto[] = "auto"; -static const char *endian_enum[] = +static const char *const endian_enum[] = { endian_big, endian_little, diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 18204514a05..532abc2229c 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -97,7 +97,7 @@ static struct cmd_list_element *showarmcmdlist = NULL; /* The type of floating-point to use. Keep this in sync with enum arm_float_model, and the help string in _initialize_arm_tdep. */ -static const char *fp_model_strings[] = +static const char *const fp_model_strings[] = { "auto", "softfpa", @@ -112,7 +112,7 @@ static enum arm_float_model arm_fp_model = ARM_FLOAT_AUTO; static const char *current_fp_model = "auto"; /* The ABI to use. Keep this in sync with arm_abi_kind. */ -static const char *arm_abi_strings[] = +static const char *const arm_abi_strings[] = { "auto", "APCS", @@ -125,7 +125,7 @@ static enum arm_abi_kind arm_abi_global = ARM_ABI_AUTO; static const char *arm_abi_string = "auto"; /* The execution mode to assume. */ -static const char *arm_mode_strings[] = +static const char *const arm_mode_strings[] = { "auto", "arm", diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ec7f348d26d..7d363b2d89b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -373,7 +373,7 @@ show_automatic_hardware_breakpoints (struct ui_file *file, int from_tty, static const char always_inserted_auto[] = "auto"; static const char always_inserted_on[] = "on"; static const char always_inserted_off[] = "off"; -static const char *always_inserted_enums[] = { +static const char *const always_inserted_enums[] = { always_inserted_auto, always_inserted_off, always_inserted_on, diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 9c118e10f54..5eeab415093 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -201,7 +201,7 @@ static const char script_ext_off[] = "off"; static const char script_ext_soft[] = "soft"; static const char script_ext_strict[] = "strict"; -static const char *script_ext_enums[] = { +static const char *const script_ext_enums[] = { script_ext_off, script_ext_soft, script_ext_strict, diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index f168ff19d4c..da5f917dc1f 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -412,7 +412,7 @@ add_setshow_cmd_full (char *name, void add_setshow_enum_cmd (char *name, enum command_class class, - const char *enumlist[], + const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, @@ -1733,7 +1733,7 @@ complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word) "oobar"; if WORD is "baz/foo", return "baz/foobar". */ char ** -complete_on_enum (const char *enumlist[], +complete_on_enum (const char *const *enumlist, char *text, char *word) { diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 946f96dc36b..6027123f5ae 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -189,7 +189,7 @@ struct cmd_list_element /* Pointer to NULL terminated list of enumerated values (like argv). */ - const char **enums; + const char *const *enums; /* Pointer to command strings of user-defined commands */ struct command_line *user_commands; diff --git a/gdb/command.h b/gdb/command.h index da1c8d48a7b..c18e2dd842a 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -211,7 +211,7 @@ extern struct cmd_list_element *add_info_alias (char *, char *, int); extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *); -extern char **complete_on_enum (const char *enumlist[], +extern char **complete_on_enum (const char *const *enumlist, char *, char *); /* Functions that implement commands about CLI commands. */ @@ -232,7 +232,7 @@ extern show_value_ftype deprecated_show_value_hack; extern void add_setshow_enum_cmd (char *name, enum command_class class, - const char *enumlist[], + const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 963a8ab7b9a..daa92e532cf 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -151,7 +151,7 @@ static int usr_cmd_cris_version_valid = 0; static const char cris_mode_normal[] = "normal"; static const char cris_mode_guru[] = "guru"; -static const char *cris_modes[] = { +static const char *const cris_modes[] = { cris_mode_normal, cris_mode_guru, 0 diff --git a/gdb/filesystem.c b/gdb/filesystem.c index a32b95784d2..d855b7511c9 100644 --- a/gdb/filesystem.c +++ b/gdb/filesystem.c @@ -25,7 +25,7 @@ const char file_system_kind_auto[] = "auto"; const char file_system_kind_unix[] = "unix"; const char file_system_kind_dos_based[] = "dos-based"; -const char *target_file_system_kinds[] = +const char *const target_file_system_kinds[] = { file_system_kind_auto, file_system_kind_unix, diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 549297e701c..f6a6f381e27 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -376,7 +376,7 @@ i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg) its legitimate values. */ static const char att_flavor[] = "att"; static const char intel_flavor[] = "intel"; -static const char *valid_flavors[] = +static const char *const valid_flavors[] = { att_flavor, intel_flavor, @@ -2545,7 +2545,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type, static const char default_struct_convention[] = "default"; static const char pcc_struct_convention[] = "pcc"; static const char reg_struct_convention[] = "reg"; -static const char *valid_conventions[] = +static const char *const valid_conventions[] = { default_struct_convention, pcc_struct_convention, diff --git a/gdb/infrun.c b/gdb/infrun.c index bb4139a149c..85b6e472a06 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -389,7 +389,7 @@ void init_infwait_state (void); static const char follow_fork_mode_child[] = "child"; static const char follow_fork_mode_parent[] = "parent"; -static const char *follow_fork_mode_kind_names[] = { +static const char *const follow_fork_mode_kind_names[] = { follow_fork_mode_child, follow_fork_mode_parent, NULL @@ -778,7 +778,7 @@ handle_vfork_child_exec_or_exit (int exec) static const char follow_exec_mode_new[] = "new"; static const char follow_exec_mode_same[] = "same"; -static const char *follow_exec_mode_names[] = +static const char *const follow_exec_mode_names[] = { follow_exec_mode_new, follow_exec_mode_same, @@ -1175,7 +1175,7 @@ infrun_inferior_exit (struct inferior *inf) static const char can_use_displaced_stepping_auto[] = "auto"; static const char can_use_displaced_stepping_on[] = "on"; static const char can_use_displaced_stepping_off[] = "off"; -static const char *can_use_displaced_stepping_enum[] = +static const char *const can_use_displaced_stepping_enum[] = { can_use_displaced_stepping_auto, can_use_displaced_stepping_on, @@ -1579,7 +1579,7 @@ resume_cleanups (void *ignore) static const char schedlock_off[] = "off"; static const char schedlock_on[] = "on"; static const char schedlock_step[] = "step"; -static const char *scheduler_enums[] = { +static const char *const scheduler_enums[] = { schedlock_off, schedlock_on, schedlock_step, @@ -6907,7 +6907,7 @@ int execution_direction = EXEC_FORWARD; static const char exec_forward[] = "forward"; static const char exec_reverse[] = "reverse"; static const char *exec_direction = exec_forward; -static const char *exec_direction_names[] = { +static const char *const exec_direction_names[] = { exec_forward, exec_reverse, NULL diff --git a/gdb/language.c b/gdb/language.c index 46b7dce8a7c..d92830f9658 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1109,10 +1109,10 @@ language_lookup_primitive_type_by_name (const struct language_defn *la, void _initialize_language (void) { - static const char *type_or_range_names[] + static const char *const type_or_range_names[] = { "on", "off", "warn", "auto", NULL }; - static const char *case_sensitive_names[] + static const char *const case_sensitive_names[] = { "on", "off", "auto", NULL }; language_gdbarch_data diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index ff06ccf99b7..63b449d20e9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -82,7 +82,7 @@ enum static const char *mips_abi_string; -static const char *mips_abi_strings[] = { +static const char *const mips_abi_strings[] = { "auto", "n32", "o32", diff --git a/gdb/python/python.c b/gdb/python/python.c index 795dd4425d2..735d94dbdbe 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -41,7 +41,7 @@ static const char python_excp_full[] = "full"; static const char python_excp_message[] = "message"; /* "set python print-stack" choices. */ -static const char *python_excp_enums[] = +static const char *const python_excp_enums[] = { python_excp_none, python_excp_full, diff --git a/gdb/remote.c b/gdb/remote.c index 1277641011b..11539806cdf 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -742,7 +742,7 @@ static int wait_forever_enabled_p = 1; const char interrupt_sequence_control_c[] = "Ctrl-C"; const char interrupt_sequence_break[] = "BREAK"; const char interrupt_sequence_break_g[] = "BREAK-g"; -static const char *interrupt_sequence_modes[] = +static const char *const interrupt_sequence_modes[] = { interrupt_sequence_control_c, interrupt_sequence_break, diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 62ec07feddc..ca488c3a0f9 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -108,7 +108,7 @@ static struct cmd_list_element *showpowerpccmdlist = NULL; static enum auto_boolean powerpc_soft_float_global = AUTO_BOOLEAN_AUTO; /* The vector ABI to use. Keep this in sync with powerpc_vector_abi. */ -static const char *powerpc_vector_strings[] = +static const char *const powerpc_vector_strings[] = { "auto", "generic", diff --git a/gdb/serial.c b/gdb/serial.c index 868858a8e22..3eed3b9dbcb 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -53,7 +53,7 @@ static void serial_logchar (struct ui_file *stream, static const char logbase_hex[] = "hex"; static const char logbase_octal[] = "octal"; static const char logbase_ascii[] = "ascii"; -static const char *logbase_enums[] = +static const char *const logbase_enums[] = {logbase_hex, logbase_octal, logbase_ascii, NULL}; static const char *serial_logbase = logbase_ascii; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 519a8b4fe97..635939dd67d 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -59,7 +59,7 @@ static struct cmd_list_element *showshcmdlist = NULL; static const char sh_cc_gcc[] = "gcc"; static const char sh_cc_renesas[] = "renesas"; -static const char *sh_cc_enum[] = { +static const char *const sh_cc_enum[] = { sh_cc_gcc, sh_cc_renesas, NULL diff --git a/gdb/stack.c b/gdb/stack.c index 6536d74506e..cf9125bcbbe 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -59,7 +59,7 @@ void (*deprecated_selected_frame_level_changed_hook) (int); /* The possible choices of "set print frame-arguments", and the value of this setting. */ -static const char *print_frame_arguments_choices[] = +static const char *const print_frame_arguments_choices[] = {"all", "scalars", "none", NULL}; static const char *print_frame_arguments = "scalars"; @@ -73,7 +73,7 @@ const char print_entry_values_if_needed[] = "if-needed"; const char print_entry_values_both[] = "both"; const char print_entry_values_compact[] = "compact"; const char print_entry_values_default[] = "default"; -static const char *print_entry_values_choices[] = +static const char *const print_entry_values_choices[] = { print_entry_values_no, print_entry_values_only, diff --git a/gdb/symtab.c b/gdb/symtab.c index dbef7591f8a..216d6fe2a10 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -122,7 +122,7 @@ int basenames_may_differ = 0; const char multiple_symbols_ask[] = "ask"; const char multiple_symbols_all[] = "all"; const char multiple_symbols_cancel[] = "cancel"; -static const char *multiple_symbols_modes[] = +static const char *const multiple_symbols_modes[] = { multiple_symbols_ask, multiple_symbols_all, diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 0a49697d69e..a555145abbe 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -107,7 +107,7 @@ static void parse_scrolling_args (char *, #endif /* Possible values for tui-border-kind variable. */ -static const char *tui_border_kind_enums[] = { +static const char *const tui_border_kind_enums[] = { "space", "ascii", "acs", @@ -115,7 +115,7 @@ static const char *tui_border_kind_enums[] = { }; /* Possible values for tui-border-mode and tui-active-border-mode. */ -static const char *tui_border_mode_enums[] = { +static const char *const tui_border_mode_enums[] = { "normal", "standout", "reverse", diff --git a/gdb/utils.c b/gdb/utils.c index 39ec2541155..1ebb9354134 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -886,7 +886,7 @@ can_dump_core (const char *reason) const char internal_problem_ask[] = "ask"; const char internal_problem_yes[] = "yes"; const char internal_problem_no[] = "no"; -static const char *internal_problem_modes[] = +static const char *const internal_problem_modes[] = { internal_problem_ask, internal_problem_yes,