diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-07 16:51:11 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-07 16:51:11 +0000 |
commit | e99c3a1d0a11dad2e2b51f061ad4d3c0a98b67b6 (patch) | |
tree | d04fec1eb92b81beff3e31812e987a40cf880773 /gcc | |
parent | 3bd67e9ceee5b55bc1fcd95eb47d239865de3d37 (diff) | |
download | gcc-e99c3a1d0a11dad2e2b51f061ad4d3c0a98b67b6.tar.gz |
* builtins.c (expand_builtin_setjmp_receiver): Const-ify.
* c-common.c (fname_var_t, c_tree_code_type, c_tree_code_length):
Likewise.
* c-dump.c (dump_option_value_info): Likewise.
* c-format.c (format_length_info, format_char_info,
format_flag_spec, format_flag_pair, format_kind_info): Likewise.
* collect2.c (names): Likewise.
* cppdefault.h (default_include): Likewise.
* cppexp.c (suffix, vsuf_1, vsuf_2, vsuf_3): Likewise.
* flow.c (life_analysis): Likewise.
* gcc.c (dir_separator_str, modify_target, option_map,
target_option_translations, spec_list_1, extra_specs_1,
init_spec): Likewise.
* gcov.c (gcov_version_string): Likewise.
* genattr.c (write_units): Likewise.
* genattrtab.c (make_length_attrs, write_function_unit_info): Likewise.
* gengenrtl.c (rtx_definition, defs): Likewise.
* genrecog.c (pred_table): Likewise.
* global.c (global_alloc): Likewise.
* lcm.c (optimize_mode_switching): Likewise.
* local-alloc.c (find_free_reg): Likewise.
* params.h (param_info): Likewise.
* predict.c (predictor_info): Likewise.
* protoize.c (unexpansion_struct): Likewise.
* real.c (bmask): Likewise.
* recog.h (insn_operand_data, insn_data): Likewise.
* regclass.c (initial_fixed_regs, initial_call_used_regs): Likewise.
* stmt.c (expand_nl_goto_receiver): Likewise.
* toplev.c (da, debug_args, lang_opt, documented_lang_options,
target_switches, target_options): Likewise.
* tradcif.y (token, tokentab2, yylex): Likewise.
* tree.h (attribute_spec): Likewise.
* alpha.c (override_options, alpha_lookup_xfloating_lib_func):
Likewise.
* arc.c (arc_output_function_epilogue): Likewise.
* arm.c (processors, all_cores, all_architectures,
arm_override_options, isr_attribute_arg, isr_attribute_args,
arm_isr_value): Likewise.
* avr.c (mcu_type_s, reg_class_tab, order_regs_for_local_alloc):
Likewise.
* c4x.c (c4x_int_reglist): Likewise.
* d30v.c (override_options): Likewise.
* h8300.c (shift_insn): Likewise.
* i386.c (size_cost, i386_cost, i486_cost, pentium_cost,
pentiumpro_cost, k6_cost, athlon_cost, pentium4_cost, ix86_cost,
ix86_expand_sse_comi, ix86_expand_sse_compare, override_options,
builtin_description, bdesc_comi, bdesc_2arg, bdesc_1arg,
ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise.
* i386.h (processor_costs, ix86_cost): Likewise.
* m68hc11.c (m68hc11_cost, m6811_cost, m6812_cost): Likewise.
* m68hc11.h (processor_costs, m68hc11_cost): Likewise.
* m68k.c (codes_68881, codes_FPA): Likewise.
* m88k.c (mode_from_align, max_from_align, all_from_align,
best_from_align, m_options): Likewise.
* m88k.h (ORDER_REGS_FOR_LOCAL_ALLOC): Likewise.
* mcore.c (mode_from_align): Likewise.
* mips/elf64.h (UNIQUE_SECTION): Likewise.
* mips/iris6gld.h (UNIQUE_SECTION): Likewise.
* mips.c (mips_sw_reg_names, mips_regno_to_class): Likewise.
* mips.h (mips_regno_to_class): Likewise.
* ns32k.c (scales): Likewise.
* pa.c (import_string, magic_milli): Likewise.
* rs6000.c (alt_reg_names, rs6000_override_options): Likewise.
* sparc.c (leaf_reg_remap, sparc_override_options,
reg_leaf_alloc_order, reg_nonleaf_alloc_order, reg_alloc_orders):
Likewise.
* sparc.h (sparc_cpu_select, leaf_reg_remap): Likewise.
cp:
* class.c (build_vtable_entry_ref): Const-ify.
* decl.c (predefined_identifier,
initialize_predefined_identifiers): Likewise.
* init.c (build_new_1): Likewise.
* lex.c (cplus_tree_code_type, cplus_tree_code_length, resword):
Likewise.
f:
* bad.c (_ffebad_message_, ffebad_messages_): Const-ify.
* bld.c (ffebld_arity_op_): Likewise.
* bld.h (ffebld_arity_op_): Likewise.
* com.c (ffecom_init_0): Likewise.
* intdoc.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_,
_ffeintrin_imp_, names, gens, imps, specs, cc_pair,
cc_descriptions, cc_summaries): Likewise.
* intrin.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_,
_ffeintrin_imp_, ffeintrin_names_, ffeintrin_gens_,
ffeintrin_imps_, ffeintrin_specs_): Likewise.
java:
* jcf-io.c (format_uint): Const-ify.
* lang.c (java_tree_code_type, java_tree_code_length): Likewise.
* lex.c (java_get_line_col): Likewise.
* parse.y (build_incdec): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46062 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
71 files changed, 488 insertions, 377 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ad7b71eb57..69b837b0cd3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,74 @@ +2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * builtins.c (expand_builtin_setjmp_receiver): Const-ify. + * c-common.c (fname_var_t, c_tree_code_type, c_tree_code_length): + Likewise. + * c-dump.c (dump_option_value_info): Likewise. + * c-format.c (format_length_info, format_char_info, + format_flag_spec, format_flag_pair, format_kind_info): Likewise. + * collect2.c (names): Likewise. + * cppdefault.h (default_include): Likewise. + * cppexp.c (suffix, vsuf_1, vsuf_2, vsuf_3): Likewise. + * flow.c (life_analysis): Likewise. + * gcc.c (dir_separator_str, modify_target, option_map, + target_option_translations, spec_list_1, extra_specs_1, + init_spec): Likewise. + * gcov.c (gcov_version_string): Likewise. + * genattr.c (write_units): Likewise. + * genattrtab.c (make_length_attrs, write_function_unit_info): Likewise. + * gengenrtl.c (rtx_definition, defs): Likewise. + * genrecog.c (pred_table): Likewise. + * global.c (global_alloc): Likewise. + * lcm.c (optimize_mode_switching): Likewise. + * local-alloc.c (find_free_reg): Likewise. + * params.h (param_info): Likewise. + * predict.c (predictor_info): Likewise. + * protoize.c (unexpansion_struct): Likewise. + * real.c (bmask): Likewise. + * recog.h (insn_operand_data, insn_data): Likewise. + * regclass.c (initial_fixed_regs, initial_call_used_regs): Likewise. + * stmt.c (expand_nl_goto_receiver): Likewise. + * toplev.c (da, debug_args, lang_opt, documented_lang_options, + target_switches, target_options): Likewise. + * tradcif.y (token, tokentab2, yylex): Likewise. + * tree.h (attribute_spec): Likewise. + + * alpha.c (override_options, alpha_lookup_xfloating_lib_func): + Likewise. + * arc.c (arc_output_function_epilogue): Likewise. + * arm.c (processors, all_cores, all_architectures, + arm_override_options, isr_attribute_arg, isr_attribute_args, + arm_isr_value): Likewise. + * avr.c (mcu_type_s, reg_class_tab, order_regs_for_local_alloc): + Likewise. + * c4x.c (c4x_int_reglist): Likewise. + * d30v.c (override_options): Likewise. + * h8300.c (shift_insn): Likewise. + * i386.c (size_cost, i386_cost, i486_cost, pentium_cost, + pentiumpro_cost, k6_cost, athlon_cost, pentium4_cost, ix86_cost, + ix86_expand_sse_comi, ix86_expand_sse_compare, override_options, + builtin_description, bdesc_comi, bdesc_2arg, bdesc_1arg, + ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise. + * i386.h (processor_costs, ix86_cost): Likewise. + * m68hc11.c (m68hc11_cost, m6811_cost, m6812_cost): Likewise. + * m68hc11.h (processor_costs, m68hc11_cost): Likewise. + * m68k.c (codes_68881, codes_FPA): Likewise. + * m88k.c (mode_from_align, max_from_align, all_from_align, + best_from_align, m_options): Likewise. + * m88k.h (ORDER_REGS_FOR_LOCAL_ALLOC): Likewise. + * mcore.c (mode_from_align): Likewise. + * mips/elf64.h (UNIQUE_SECTION): Likewise. + * mips/iris6gld.h (UNIQUE_SECTION): Likewise. + * mips.c (mips_sw_reg_names, mips_regno_to_class): Likewise. + * mips.h (mips_regno_to_class): Likewise. + * ns32k.c (scales): Likewise. + * pa.c (import_string, magic_milli): Likewise. + * rs6000.c (alt_reg_names, rs6000_override_options): Likewise. + * sparc.c (leaf_reg_remap, sparc_override_options, + reg_leaf_alloc_order, reg_nonleaf_alloc_order, reg_alloc_orders): + Likewise. + * sparc.h (sparc_cpu_select, leaf_reg_remap): Likewise. + 2001-10-07 Dale Johannesen <dalej@apple.com> * reload1.c (reload_reg_free_p): Teach register interference diff --git a/gcc/builtins.c b/gcc/builtins.c index f5e1beb34bc..0576886490d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -530,7 +530,7 @@ expand_builtin_setjmp_receiver (receiver_label) { #ifdef ELIMINABLE_REGS size_t i; - static struct elims {int from, to;} elim_regs[] = ELIMINABLE_REGS; + static const struct elims {const int from, to;} elim_regs[] = ELIMINABLE_REGS; for (i = 0; i < ARRAY_SIZE (elim_regs); i++) if (elim_regs[i].from == ARG_POINTER_REGNUM diff --git a/gcc/c-common.c b/gcc/c-common.c index 2f5b00a4b00..da90224d89f 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -220,9 +220,9 @@ int skip_evaluation; /* Information about how a function name is generated. */ struct fname_var_t { - tree *decl; /* pointer to the VAR_DECL. */ - unsigned rid; /* RID number for the identifier. */ - int pretty; /* How pretty is it? */ + tree *const decl; /* pointer to the VAR_DECL. */ + const unsigned rid; /* RID number for the identifier. */ + const int pretty; /* How pretty is it? */ }; /* The three ways of getting then name of the current function. */ @@ -3446,7 +3446,7 @@ c_unsafe_for_reeval (exp) #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, -static char c_tree_code_type[] = { +static const char c_tree_code_type[] = { 'x', #include "c-common.def" }; @@ -3458,7 +3458,7 @@ static char c_tree_code_type[] = { #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, -static int c_tree_code_length[] = { +static const int c_tree_code_length[] = { 0, #include "c-common.def" }; diff --git a/gcc/c-dump.c b/gcc/c-dump.c index 904e76be8ad..c26f288cacd 100644 --- a/gcc/c-dump.c +++ b/gcc/c-dump.c @@ -809,8 +809,8 @@ static struct dump_file_info dump_files[TDI_end] = /* Define a name->number mapping for a dump flag value. */ struct dump_option_value_info { - const char *name; /* the name of the value */ - int value; /* the value of the name */ + const char *const name; /* the name of the value */ + const int value; /* the value of the name */ }; /* Table of dump options. This must be consistent with the TDF_* flags diff --git a/gcc/c-format.c b/gcc/c-format.c index ea6ef57fa6d..19bbccec79f 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -387,15 +387,15 @@ enum typedef struct { /* Name of the single-character length modifier. */ - const char *name; + const char *const name; /* Index into a format_char_info.types array. */ - enum format_lengths index; + const enum format_lengths index; /* Standard version this length appears in. */ - enum format_std_version std; + const enum format_std_version std; /* Same, if the modifier can be repeated, or NULL if it can't. */ - const char *double_name; - enum format_lengths double_index; - enum format_std_version double_std; + const char *const double_name; + const enum format_lengths double_index; + const enum format_std_version double_std; } format_length_info; @@ -424,18 +424,18 @@ typedef struct which act identically), and the length modifiers used with it. */ typedef struct { - const char *format_chars; - int pointer_count; - enum format_std_version std; + const char *const format_chars; + const int pointer_count; + const enum format_std_version std; /* Types accepted for each length modifier. */ - format_type_detail types[FMT_LEN_MAX]; + const format_type_detail types[FMT_LEN_MAX]; /* List of other modifier characters allowed with these specifiers. This lists flags, and additionally "w" for width, "p" for precision (right precision, for strfmon), "#" for left precision (strfmon), "a" for scanf "a" allocation extension (not applicable in C99 mode), "*" for scanf suppression, and "E" and "O" for those strftime modifiers. */ - const char *flag_chars; + const char *const flag_chars; /* List of additional flags describing these conversion specifiers. "c" for generic character pointers being allowed, "2" for strftime two digit year formats, "3" for strftime formats giving two digit @@ -445,7 +445,7 @@ typedef struct "R" if the argument is a pointer which is dereferenced and read from, "i" for printf integer formats where the '0' flag is ignored with precision, and "[" for the starting character of a scanf scanset. */ - const char *flags2; + const char *const flags2; } format_char_info; @@ -453,7 +453,7 @@ typedef struct typedef struct { /* The flag character in question (0 for end of array). */ - int flag_char; + const int flag_char; /* Zero if this entry describes the flag character in general, or a non-zero character that may be found in flags2 if it describes the flag when used with certain formats only. If the latter, only @@ -462,18 +462,18 @@ typedef struct will be used, if non-NULL and the standard version is higher than the unpredicated one, for any pedantic warning. For example, 'o' for strftime formats (meaning 'O' is an extension over C99). */ - int predicate; + const int predicate; /* Nonzero if the next character after this flag in the format should be skipped ('=' in strfmon), zero otherwise. */ - int skip_next_char; + const int skip_next_char; /* The name to use for this flag in diagnostic messages. For example, N_("`0' flag"), N_("field width"). */ - const char *name; + const char *const name; /* Long name for this flag in diagnostic messages; currently only used for "ISO C does not support ...". For example, N_("the `I' printf flag"). */ - const char *long_name; + const char *const long_name; /* The standard version in which it appeared. */ - enum format_std_version std; + const enum format_std_version std; } format_flag_spec; @@ -482,16 +482,16 @@ typedef struct typedef struct { /* The first flag character in question (0 for end of array). */ - int flag_char1; + const int flag_char1; /* The second flag character. */ - int flag_char2; + const int flag_char2; /* Non-zero if the message should say that the first flag is ignored with the second, zero if the combination should simply be objected to. */ - int ignored; + const int ignored; /* Zero if this entry applies whenever this flag combination occurs, a non-zero character from flags2 if it only applies in some circumstances (e.g. 'i' for printf formats ignoring 0 with precision). */ - int predicate; + const int predicate; } format_flag_pair; @@ -500,43 +500,43 @@ typedef struct { /* The name of this kind of format, for use in diagnostics. Also the name of the attribute (without preceding and following __). */ - const char *name; + const char *const name; /* Specifications of the length modifiers accepted; possibly NULL. */ - const format_length_info *length_char_specs; + const format_length_info *const length_char_specs; /* Details of the conversion specification characters accepted. */ - const format_char_info *conversion_specs; + const format_char_info *const conversion_specs; /* String listing the flag characters that are accepted. */ - const char *flag_chars; + const char *const flag_chars; /* String listing modifier characters (strftime) accepted. May be NULL. */ - const char *modifier_chars; + const char *const modifier_chars; /* Details of the flag characters, including pseudo-flags. */ - const format_flag_spec *flag_specs; + const format_flag_spec *const flag_specs; /* Details of bad combinations of flags. */ - const format_flag_pair *bad_flag_pairs; + const format_flag_pair *const bad_flag_pairs; /* Flags applicable to this kind of format. */ - int flags; + const int flags; /* Flag character to treat a width as, or 0 if width not used. */ - int width_char; + const int width_char; /* Flag character to treat a left precision (strfmon) as, or 0 if left precision not used. */ - int left_precision_char; + const int left_precision_char; /* Flag character to treat a precision (for strfmon, right precision) as, or 0 if precision not used. */ - int precision_char; + const int precision_char; /* If a flag character has the effect of suppressing the conversion of an argument ('*' in scanf), that flag character, otherwise 0. */ - int suppression_char; + const int suppression_char; /* Flag character to treat a length modifier as (ignored if length modifiers not used). Need not be placed in flag_chars for conversion specifiers, but is used to check for bad combinations such as length modifier with assignment suppression in scanf. */ - int length_code_char; + const int length_code_char; /* Pointer to type of argument expected if '*' is used for a width, or NULL if '*' not used for widths. */ - tree *width_type; + tree *const width_type; /* Pointer to type of argument expected if '*' is used for a precision, or NULL if '*' not used for precisions. */ - tree *precision_type; + tree *const precision_type; } format_kind_info; diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 8e6582f06db..bbe8dc7c117 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -685,10 +685,10 @@ utf8_extend_token (c) #if 0 struct try_type { - tree *node_var; - char unsigned_flag; - char long_flag; - char long_long_flag; + tree *const node_var; + const char unsigned_flag; + const char long_flag; + const char long_long_flag; }; struct try_type type_sequence[] = diff --git a/gcc/collect2.c b/gcc/collect2.c index dc3b7f8f258..7b5078cf1f3 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -557,7 +557,8 @@ static int is_ctor_dtor (s) const char *s; { - struct names { const char *const name; int len; int ret; int two_underscores; }; + struct names { const char *const name; const int len; const int ret; + const int two_underscores; }; register struct names *p; register int ch; diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 4439368242f..1b599540cba 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -221,10 +221,10 @@ void override_options () { int i; - static struct cpu_table { - const char *name; - enum processor_type processor; - int flags; + static const struct cpu_table { + const char *const name; + const enum processor_type processor; + const int flags; } cpu_table[] = { #define EV5_MASK (MASK_CPU_EV5) #define EV6_MASK (MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX) @@ -2985,8 +2985,8 @@ alpha_lookup_xfloating_lib_func (code) { struct xfloating_op { - enum rtx_code code; - const char *func; + const enum rtx_code code; + const char *const func; }; static const struct xfloating_op vms_xfloating_ops[] = diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 6875a6f502c..49b0f162b8e 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -1299,7 +1299,7 @@ arc_output_function_epilogue (file, size) /* Emit the return instruction. */ { - static int regs[4] = { + static const int regs[4] = { 0, RETURN_ADDR_REGNUM, ILINK1_REGNUM, ILINK2_REGNUM }; fprintf (file, "\tj.d %s\n", reg_names[regs[fn_type]]); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index fcd90ddf4bd..3e2192b3b4a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -286,13 +286,13 @@ static const char *const arm_condition_codes[] = struct processors { - const char * name; - unsigned int flags; + const char *const name; + const unsigned int flags; }; /* Not all of these give usefully different compilation alternatives, but there is no simple way of generalizing them. */ -static struct processors all_cores[] = +static const struct processors all_cores[] = { /* ARM Cores */ @@ -345,7 +345,7 @@ static struct processors all_cores[] = {NULL, 0} }; -static struct processors all_architectures[] = +static const struct processors all_architectures[] = { /* ARM Architectures */ @@ -436,12 +436,12 @@ arm_override_options () /* If the user did not specify a processor, choose one for them. */ if (insn_flags == 0) { - struct processors * sel; + const struct processors * sel; unsigned int sought; - static struct cpu_default + static const struct cpu_default { - int cpu; - const char * name; + const int cpu; + const char *const name; } cpu_defaults[] = { @@ -460,7 +460,7 @@ arm_override_options () { TARGET_CPU_generic, "arm" }, { 0, 0 } }; - struct cpu_default * def; + const struct cpu_default * def; /* Find the default. */ for (def = cpu_defaults; def->name; def++) @@ -513,7 +513,7 @@ arm_override_options () if (sel->name == NULL) { unsigned int current_bit_count = 0; - struct processors * best_fit = NULL; + const struct processors * best_fit = NULL; /* Ideally we would like to issue an error message here saying that it was not possible to find a CPU compatible @@ -760,12 +760,12 @@ arm_add_gc_roots () typedef struct { - const char * arg; - unsigned long return_value; + const char *const arg; + const unsigned long return_value; } isr_attribute_arg; -static isr_attribute_arg isr_attribute_args [] = +static const isr_attribute_arg isr_attribute_args [] = { { "IRQ", ARM_FT_ISR }, { "irq", ARM_FT_ISR }, @@ -789,7 +789,7 @@ static unsigned long arm_isr_value (argument) tree argument; { - isr_attribute_arg * ptr; + const isr_attribute_arg * ptr; const char * arg; /* No argument - default to IRQ. */ diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index ed54cbb3553..b576773fa6c 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -120,8 +120,8 @@ enum avr_arch { }; struct mcu_type_s { - const char *name; - enum avr_arch arch; + const char *const name; + const enum avr_arch arch; }; /* List of all known AVR MCU types - if updated, it has to be kept @@ -242,7 +242,7 @@ avr_init_once () /* return register class from register number */ -static int reg_class_tab[]={ +static const int reg_class_tab[]={ GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS, GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS, GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS,GENERAL_REGS, @@ -4831,7 +4831,7 @@ void order_regs_for_local_alloc () { unsigned int i; - int order_0[] = { + static const int order_0[] = { 24,25, 18,19, 20,21, @@ -4843,7 +4843,7 @@ order_regs_for_local_alloc () 0,1, 32,33,34,35 }; - int order_1[] = { + static const int order_1[] = { 18,19, 20,21, 22,23, @@ -4855,7 +4855,7 @@ order_regs_for_local_alloc () 0,1, 32,33,34,35 }; - int order_2[] = { + static const int order_2[] = { 25,24, 23,22, 21,20, @@ -4869,9 +4869,9 @@ order_regs_for_local_alloc () 32,33,34,35 }; - int *order = (TARGET_ORDER_1 ? order_1 : - TARGET_ORDER_2 ? order_2 : - order_0); + const int *order = (TARGET_ORDER_1 ? order_1 : + TARGET_ORDER_2 ? order_2 : + order_0); for (i=0; i < ARRAY_SIZE (order_0); ++i) reg_alloc_order[i] = order[i]; } diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 7ed86b2ba58..b59d34475d7 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -503,7 +503,7 @@ c4x_hard_regno_rename_ok (regno1, regno2) Don't use R0 to pass arguments in, we use 0 to indicate a stack argument. */ -static int c4x_int_reglist[3][6] = +static const int c4x_int_reglist[3][6] = { {AR2_REGNO, R2_REGNO, R3_REGNO, RC_REGNO, RS_REGNO, RE_REGNO}, {AR2_REGNO, R3_REGNO, RC_REGNO, RS_REGNO, RE_REGNO, 0}, diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index 2af7b26c271..a5d87454680 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -247,7 +247,7 @@ override_options () #if 0 { - static char *names[] = REG_CLASS_NAMES; + static const char *const names[] = REG_CLASS_NAMES; fprintf (stderr, "Register %s class is %s, can hold modes", reg_names[regno], names[class]); for (mode1 = VOIDmode; (int)mode1 < NUM_MACHINE_MODES; diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 34686a6440e..a0ed2b2b9ce 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -2006,8 +2006,8 @@ enum shift_mode struct shift_insn { - const char *assembler; - int cc_valid; + const char *const assembler; + const int cc_valid; }; /* Assembler instruction shift table. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d88c853a52a..933459a2c8f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ #endif /* Processor costs (relative to an add) */ +static const struct processor_costs size_cost = { /* costs for tunning for size */ 2, /* cost of an add instruction */ 3, /* cost of a lea instruction */ @@ -80,6 +81,7 @@ struct processor_costs size_cost = { /* costs for tunning for size */ 3, /* MMX or SSE register to integer */ }; /* Processor costs (relative to an add) */ +static const struct processor_costs i386_cost = { /* 386 specific costs */ 1, /* cost of an add instruction */ 1, /* cost of a lea instruction */ @@ -112,6 +114,7 @@ struct processor_costs i386_cost = { /* 386 specific costs */ 3, /* MMX or SSE register to integer */ }; +static const struct processor_costs i486_cost = { /* 486 specific costs */ 1, /* cost of an add instruction */ 1, /* cost of a lea instruction */ @@ -144,6 +147,7 @@ struct processor_costs i486_cost = { /* 486 specific costs */ 3 /* MMX or SSE register to integer */ }; +static const struct processor_costs pentium_cost = { 1, /* cost of an add instruction */ 1, /* cost of a lea instruction */ @@ -176,6 +180,7 @@ struct processor_costs pentium_cost = { 3 /* MMX or SSE register to integer */ }; +static const struct processor_costs pentiumpro_cost = { 1, /* cost of an add instruction */ 1, /* cost of a lea instruction */ @@ -208,6 +213,7 @@ struct processor_costs pentiumpro_cost = { 3 /* MMX or SSE register to integer */ }; +static const struct processor_costs k6_cost = { 1, /* cost of an add instruction */ 2, /* cost of a lea instruction */ @@ -240,6 +246,7 @@ struct processor_costs k6_cost = { 6 /* MMX or SSE register to integer */ }; +static const struct processor_costs athlon_cost = { 1, /* cost of an add instruction */ 2, /* cost of a lea instruction */ @@ -272,6 +279,7 @@ struct processor_costs athlon_cost = { 6 /* MMX or SSE register to integer */ }; +static const struct processor_costs pentium4_cost = { 1, /* cost of an add instruction */ 1, /* cost of a lea instruction */ @@ -304,7 +312,7 @@ struct processor_costs pentium4_cost = { 10, /* MMX or SSE register to integer */ }; -struct processor_costs *ix86_cost = &pentium_cost; +const struct processor_costs *ix86_cost = &pentium_cost; /* Processor feature/optimization bitmasks. */ #define m_386 (1<<PROCESSOR_I386) @@ -641,10 +649,10 @@ struct ix86_address static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *)); struct builtin_description; -static rtx ix86_expand_sse_comi PARAMS ((struct builtin_description *, tree, - rtx)); -static rtx ix86_expand_sse_compare PARAMS ((struct builtin_description *, tree, - rtx)); +static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *, + tree, rtx)); +static rtx ix86_expand_sse_compare PARAMS ((const struct builtin_description *, + tree, rtx)); static rtx ix86_expand_unop1_builtin PARAMS ((enum insn_code, tree, rtx)); static rtx ix86_expand_unop_builtin PARAMS ((enum insn_code, tree, rtx, int)); static rtx ix86_expand_binop_builtin PARAMS ((enum insn_code, tree, rtx)); @@ -770,13 +778,13 @@ override_options () static struct ptt { - struct processor_costs *cost; /* Processor costs */ - int target_enable; /* Target flags to enable. */ - int target_disable; /* Target flags to disable. */ - int align_loop; /* Default alignments. */ - int align_jump; - int align_func; - int branch_cost; + const struct processor_costs *cost; /* Processor costs */ + const int target_enable; /* Target flags to enable. */ + const int target_disable; /* Target flags to disable. */ + const int align_loop; /* Default alignments. */ + const int align_jump; + const int align_func; + const int branch_cost; } const processor_target_table[PROCESSOR_max] = { @@ -791,8 +799,8 @@ override_options () static struct pta { - const char *name; /* processor name or nickname. */ - enum processor_type processor; + const char *const name; /* processor name or nickname. */ + const enum processor_type processor; } const processor_alias_table[] = { @@ -10708,15 +10716,15 @@ do { \ struct builtin_description { - unsigned int mask; - enum insn_code icode; - const char * name; - enum ix86_builtins code; - enum rtx_code comparison; - unsigned int flag; + const unsigned int mask; + const enum insn_code icode; + const char *const name; + const enum ix86_builtins code; + const enum rtx_code comparison; + const unsigned int flag; }; -static struct builtin_description bdesc_comi[] = +static const struct builtin_description bdesc_comi[] = { { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comieq", IX86_BUILTIN_COMIEQSS, EQ, 0 }, { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comilt", IX86_BUILTIN_COMILTSS, LT, 0 }, @@ -10732,7 +10740,7 @@ static struct builtin_description bdesc_comi[] = { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomineq", IX86_BUILTIN_UCOMINEQSS, NE, 0 } }; -static struct builtin_description bdesc_2arg[] = +static const struct builtin_description bdesc_2arg[] = { /* SSE */ { MASK_SSE, CODE_FOR_addv4sf3, "__builtin_ia32_addps", IX86_BUILTIN_ADDPS, 0, 0 }, @@ -10865,7 +10873,7 @@ static struct builtin_description bdesc_2arg[] = }; -static struct builtin_description bdesc_1arg[] = +static const struct builtin_description bdesc_1arg[] = { { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_pmovmskb, 0, IX86_BUILTIN_PMOVMSKB, 0, 0 }, { MASK_SSE, CODE_FOR_sse_movmskps, 0, IX86_BUILTIN_MOVMSKPS, 0, 0 }, @@ -10894,7 +10902,7 @@ ix86_init_builtins () void ix86_init_mmx_sse_builtins () { - struct builtin_description * d; + const struct builtin_description * d; size_t i; tree endlink = void_list_node; @@ -11472,7 +11480,7 @@ ix86_expand_unop1_builtin (icode, arglist, target) static rtx ix86_expand_sse_compare (d, arglist, target) - struct builtin_description *d; + const struct builtin_description *d; tree arglist; rtx target; { @@ -11524,7 +11532,7 @@ ix86_expand_sse_compare (d, arglist, target) static rtx ix86_expand_sse_comi (d, arglist, target) - struct builtin_description *d; + const struct builtin_description *d; tree arglist; rtx target; { @@ -11585,7 +11593,7 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore) enum machine_mode mode ATTRIBUTE_UNUSED; int ignore ATTRIBUTE_UNUSED; { - struct builtin_description *d; + const struct builtin_description *d; size_t i; enum insn_code icode; tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 174c59452a0..0bf603a4437 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -51,42 +51,42 @@ Boston, MA 02111-1307, USA. */ /* Define the specific costs for a given cpu */ struct processor_costs { - int add; /* cost of an add instruction */ - int lea; /* cost of a lea instruction */ - int shift_var; /* variable shift costs */ - int shift_const; /* constant shift costs */ - int mult_init; /* cost of starting a multiply */ - int mult_bit; /* cost of multiply per each bit set */ - int divide; /* cost of a divide/mod */ - int large_insn; /* insns larger than this cost more */ - int move_ratio; /* The threshold of number of scalar + const int add; /* cost of an add instruction */ + const int lea; /* cost of a lea instruction */ + const int shift_var; /* variable shift costs */ + const int shift_const; /* constant shift costs */ + const int mult_init; /* cost of starting a multiply */ + const int mult_bit; /* cost of multiply per each bit set */ + const int divide; /* cost of a divide/mod */ + const int large_insn; /* insns larger than this cost more */ + const int move_ratio; /* The threshold of number of scalar memory-to-memory move insns. */ - int movzbl_load; /* cost of loading using movzbl */ - int int_load[3]; /* cost of loading integer registers + const int movzbl_load; /* cost of loading using movzbl */ + const int int_load[3]; /* cost of loading integer registers in QImode, HImode and SImode relative to reg-reg move (2). */ - int int_store[3]; /* cost of storing integer register + const int int_store[3]; /* cost of storing integer register in QImode, HImode and SImode */ - int fp_move; /* cost of reg,reg fld/fst */ - int fp_load[3]; /* cost of loading FP register + const int fp_move; /* cost of reg,reg fld/fst */ + const int fp_load[3]; /* cost of loading FP register in SFmode, DFmode and XFmode */ - int fp_store[3]; /* cost of storing FP register + const int fp_store[3]; /* cost of storing FP register in SFmode, DFmode and XFmode */ - int mmx_move; /* cost of moving MMX register. */ - int mmx_load[2]; /* cost of loading MMX register + const int mmx_move; /* cost of moving MMX register. */ + const int mmx_load[2]; /* cost of loading MMX register in SImode and DImode */ - int mmx_store[2]; /* cost of storing MMX register + const int mmx_store[2]; /* cost of storing MMX register in SImode and DImode */ - int sse_move; /* cost of moving SSE register. */ - int sse_load[3]; /* cost of loading SSE register + const int sse_move; /* cost of moving SSE register. */ + const int sse_load[3]; /* cost of loading SSE register in SImode, DImode and TImode*/ - int sse_store[3]; /* cost of storing SSE register + const int sse_store[3]; /* cost of storing SSE register in SImode, DImode and TImode*/ - int mmxsse_to_integer; /* cost of moving mmxsse register to + const int mmxsse_to_integer; /* cost of moving mmxsse register to integer and vice versa. */ }; -extern struct processor_costs *ix86_cost; +extern const struct processor_costs *ix86_cost; /* Run-time compilation parameters selecting different hardware subsets. */ diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 494de470329..fa0179a58c8 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -128,10 +128,10 @@ rtx m68hc11_compare_op0; rtx m68hc11_compare_op1; -struct processor_costs *m68hc11_cost; +const struct processor_costs *m68hc11_cost; /* Costs for a 68HC11. */ -struct processor_costs m6811_cost = { +static const struct processor_costs m6811_cost = { /* add */ COSTS_N_INSNS (2), /* logical */ @@ -166,7 +166,7 @@ struct processor_costs m6811_cost = { }; /* Costs for a 68HC12. */ -struct processor_costs m6812_cost = { +static const struct processor_costs m6812_cost = { /* add */ COSTS_N_INSNS (1), /* logical */ diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 3ec7159e97b..07e640b63f7 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -212,21 +212,21 @@ extern const char *m68hc11_soft_reg_count; /* Define cost parameters for a given processor variant. */ struct processor_costs { - int add; /* cost of an add instruction */ - int logical; /* cost of a logical instruction */ - int shift_var; - int shiftQI_const[8]; - int shiftHI_const[16]; - int multQI; - int multHI; - int multSI; - int divQI; - int divHI; - int divSI; + const int add; /* cost of an add instruction */ + const int logical; /* cost of a logical instruction */ + const int shift_var; + const int shiftQI_const[8]; + const int shiftHI_const[16]; + const int multQI; + const int multHI; + const int multSI; + const int divQI; + const int divHI; + const int divSI; }; /* Costs for the current processor. */ -extern struct processor_costs *m68hc11_cost; +extern const struct processor_costs *m68hc11_cost; /* target machine storage layout */ diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 3a832ffbc4c..a83168afe14 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -3049,7 +3049,7 @@ static const char *const strings_68881[7] = { "1e16" }; -int codes_68881[7] = { +static const int codes_68881[7] = { 0x0f, 0x32, 0x33, @@ -3216,7 +3216,7 @@ static const char *const strings_FPA[38] = { }; -int codes_FPA[38] = { +static const int codes_FPA[38] = { /* small rationals */ 0x200, 0xe, diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 1de96f20c2b..db5e069d594 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -485,15 +485,15 @@ legitimize_address (pic, orig, reg, scratch) #define MOVSTR_SI_LIMIT_88110 72 #define MOVSTR_DI_LIMIT_88110 72 -static enum machine_mode mode_from_align[] = +static const enum machine_mode mode_from_align[] = {VOIDmode, QImode, HImode, VOIDmode, SImode, VOIDmode, VOIDmode, VOIDmode, DImode}; -static int max_from_align[] = {0, MOVSTR_QI, MOVSTR_HI, 0, MOVSTR_SI, - 0, 0, 0, MOVSTR_DI}; -static int all_from_align[] = {0, MOVSTR_QI, MOVSTR_ODD_HI, 0, MOVSTR_ODD_SI, - 0, 0, 0, MOVSTR_ODD_DI}; +static const int max_from_align[] = {0, MOVSTR_QI, MOVSTR_HI, 0, MOVSTR_SI, + 0, 0, 0, MOVSTR_DI}; +static const int all_from_align[] = {0, MOVSTR_QI, MOVSTR_ODD_HI, 0, + MOVSTR_ODD_SI, 0, 0, 0, MOVSTR_ODD_DI}; -static int best_from_align[3][9] = { +static const int best_from_align[3][9] = { {0, MOVSTR_QI_LIMIT_88100, MOVSTR_HI_LIMIT_88100, 0, MOVSTR_SI_LIMIT_88100, 0, 0, 0, MOVSTR_DI_LIMIT_88100}, {0, MOVSTR_QI_LIMIT_88110, MOVSTR_HI_LIMIT_88110, 0, MOVSTR_SI_LIMIT_88110, @@ -1534,7 +1534,8 @@ output_option (file, sep, type, name, indent, pos, max) return pos + fprintf (file, "%s%s%s", sep, type, name); } -static struct { const char *const name; int value; } m_options[] = TARGET_SWITCHES; +static const struct { const char *const name; const int value; } m_options[] = +TARGET_SWITCHES; static void output_options (file, f_options, f_len, W_options, W_len, diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 881acd88be0..abcc050288d 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -690,8 +690,8 @@ extern int flag_pic; /* -fpic */ write-over scoreboard delays between caller and callee. */ #define ORDER_REGS_FOR_LOCAL_ALLOC \ { \ - static int leaf[] = REG_LEAF_ALLOC_ORDER; \ - static int nonleaf[] = REG_ALLOC_ORDER; \ + static const int leaf[] = REG_LEAF_ALLOC_ORDER; \ + static const int nonleaf[] = REG_ALLOC_ORDER; \ \ memcpy (reg_alloc_order, regs_ever_live[1] ? nonleaf : leaf, \ FIRST_PSEUDO_REGISTER * sizeof (int)); \ diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 0a4a2b5f80e..7b83cd92e25 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -1877,7 +1877,7 @@ mcore_store_multiple_operation (op, mode) known constants. DEST and SRC are registers. OFFSET is the known starting point for the output pattern. */ -static enum machine_mode mode_from_align[] = +static const enum machine_mode mode_from_align[] = { VOIDmode, QImode, HImode, VOIDmode, SImode, VOIDmode, VOIDmode, VOIDmode, DImode diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h index e07ce469af0..cc94020e804 100644 --- a/gcc/config/mips/elf64.h +++ b/gcc/config/mips/elf64.h @@ -197,8 +197,9 @@ do { \ #define UNIQUE_SECTION(DECL,RELOC) \ do { \ int len, size, sec; \ - char *name, *string, *prefix; \ - static char *prefixes[4][2] = { \ + const char *name, *prefix; \ + char *string; \ + static const char *const prefixes[4][2] = { \ { ".text.", ".gnu.linkonce.t." }, \ { ".rodata.", ".gnu.linkonce.r." }, \ { ".data.", ".gnu.linkonce.d." }, \ diff --git a/gcc/config/mips/iris6gld.h b/gcc/config/mips/iris6gld.h index 409af7d0ff4..addc0f7d82e 100644 --- a/gcc/config/mips/iris6gld.h +++ b/gcc/config/mips/iris6gld.h @@ -54,10 +54,10 @@ Boston, MA 02111-1307, USA. */ { \ int len; \ int sec; \ - char *name; \ + const char *name; \ char *string; \ - char *prefix; \ - static char *prefixes[/*4*/3][2] = \ + const char *prefix; \ + static const char *const prefixes[/*4*/3][2] = \ { \ { ".text.", ".gnu.linkonce.t." }, \ { ".rodata.", ".gnu.linkonce.r." }, \ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index d88b61d8a7f..9ff5be61106 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -345,7 +345,7 @@ char mips_reg_names[][8] = /* Mips software names for the registers, used to overwrite the mips_reg_names array. */ -char mips_sw_reg_names[][8] = +static const char mips_sw_reg_names[][8] = { "$zero","$at", "$v0", "$v1", "$a0", "$a1", "$a2", "$a3", "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", @@ -360,7 +360,7 @@ char mips_sw_reg_names[][8] = }; /* Map hard register number to register class */ -enum reg_class mips_regno_to_class[] = +const enum reg_class mips_regno_to_class[] = { GR_REGS, GR_REGS, M16_NA_REGS, M16_NA_REGS, M16_REGS, M16_REGS, M16_REGS, M16_REGS, diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index dfb8aff6239..121628a0785 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1982,7 +1982,7 @@ enum reg_class choose a class which is "minimal", meaning that no smaller class also contains the register. */ -extern enum reg_class mips_regno_to_class[]; +extern const enum reg_class mips_regno_to_class[]; #define REGNO_REG_CLASS(REGNO) mips_regno_to_class[ (REGNO) ] diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index a7e89c25f17..7d923c83c60 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -1195,7 +1195,7 @@ print_operand_address (file, addr) register FILE *file; register rtx addr; { - static char scales[] = { 'b', 'w', 'd', 0, 'q', }; + static const char scales[] = { 'b', 'w', 'd', 0, 'q', }; rtx offset, base, indexexp, tmp; int scale; extern int flag_pic; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index dda9d973091..fa23eaa9018 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -4457,7 +4457,7 @@ enum millicodes { remI, remU, divI, divU, mulI, mulU, end1000 }; static void import_milli PARAMS ((enum millicodes)); static char imported[(int) end1000]; static const char * const milli_names[] = {"remI", "remU", "divI", "divU", "mulI", "mulU"}; -static char import_string[] = ".IMPORT $$....,MILLICODE"; +static const char import_string[] = ".IMPORT $$....,MILLICODE"; #define MILLI_START 10 static void @@ -4490,8 +4490,8 @@ output_mul_insn (unsignedp, insn) /* Emit the rtl for doing a division by a constant. */ /* Do magic division millicodes exist for this value? */ -static int magic_milli[]= {0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, - 1, 1}; +static const int magic_milli[]= {0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, + 1, 1}; /* We'll use an array to keep track of the magic millicodes and whether or not we've used them already. [n][0] is signed, [n][1] is diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 88420ba4cab..90256195045 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -164,7 +164,7 @@ char rs6000_reg_names[][8] = }; #ifdef TARGET_REGNAMES -static char alt_reg_names[][8] = +static const char alt_reg_names[][8] = { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", @@ -227,11 +227,11 @@ rs6000_override_options (default_cpu) static struct ptt { - const char *name; /* Canonical processor name. */ - enum processor_type processor; /* Processor type enum value. */ - int target_enable; /* Target flags to enable. */ - int target_disable; /* Target flags to disable. */ - } processor_target_table[] + const char *const name; /* Canonical processor name. */ + const enum processor_type processor; /* Processor type enum value. */ + const int target_enable; /* Target flags to enable. */ + const int target_disable; /* Target flags to disable. */ + } const processor_target_table[] = {{"common", PROCESSOR_COMMON, MASK_NEW_MNEMONICS, POWER_MASKS | POWERPC_MASKS}, {"power", PROCESSOR_POWER, diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 27cd5b3af01..1af8c5f4ff1 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -87,7 +87,7 @@ static rtx leaf_label; registers. FRAME_POINTER_REGNUM cannot be remapped by this function to eliminate it. You must use -fomit-frame-pointer to get that. */ -char leaf_reg_remap[] = +const char leaf_reg_remap[] = { 0, 1, 2, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -226,9 +226,9 @@ void sparc_override_options () { static struct code_model { - const char *name; - int value; - } cmodels[] = { + const char *const name; + const int value; + } const cmodels[] = { { "32", CM_32 }, { "medlow", CM_MEDLOW }, { "medmid", CM_MEDMID }, @@ -236,12 +236,12 @@ sparc_override_options () { "embmedany", CM_EMBMEDANY }, { 0, 0 } }; - struct code_model *cmodel; + const struct code_model *cmodel; /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=. */ static struct cpu_default { - int cpu; - const char *name; - } cpu_default[] = { + const int cpu; + const char *const name; + } const cpu_default[] = { /* There must be one entry here for each TARGET_CPU value. */ { TARGET_CPU_sparc, "cypress" }, { TARGET_CPU_sparclet, "tsc701" }, @@ -254,14 +254,14 @@ sparc_override_options () { TARGET_CPU_ultrasparc, "ultrasparc" }, { 0, 0 } }; - struct cpu_default *def; + const struct cpu_default *def; /* Table of values for -m{cpu,tune}=. */ static struct cpu_table { - const char *name; - enum processor_type processor; - int disable; - int enable; - } cpu_table[] = { + const char *const name; + const enum processor_type processor; + const int disable; + const int enable; + } const cpu_table[] = { { "v7", PROCESSOR_V7, MASK_ISA, 0 }, { "cypress", PROCESSOR_CYPRESS, MASK_ISA, 0 }, { "v8", PROCESSOR_V8, MASK_ISA, MASK_V8 }, @@ -286,8 +286,8 @@ sparc_override_options () |MASK_DEPRECATED_V8_INSNS}, { 0, 0, 0, 0 } }; - struct cpu_table *cpu; - struct sparc_cpu_select *sel; + const struct cpu_table *cpu; + const struct sparc_cpu_select *sel; int fpu; #ifndef SPARC_BI_ARCH @@ -5564,13 +5564,13 @@ output_return (operands) /* Leaf functions and non-leaf functions have different needs. */ -static int +static const int reg_leaf_alloc_order[] = REG_LEAF_ALLOC_ORDER; -static int +static const int reg_nonleaf_alloc_order[] = REG_ALLOC_ORDER; -static int *reg_alloc_orders[] = { +static const int *const reg_alloc_orders[] = { reg_leaf_alloc_order, reg_nonleaf_alloc_order}; @@ -5583,7 +5583,7 @@ order_regs_for_local_alloc () { last_order_nonleaf = !last_order_nonleaf; memcpy ((char *) reg_alloc_order, - (char *) reg_alloc_orders[last_order_nonleaf], + (const char *) reg_alloc_orders[last_order_nonleaf], FIRST_PSEUDO_REGISTER * sizeof (int)); } } diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 9835881afc3..bf43ba96849 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -721,9 +721,9 @@ extern enum processor_type sparc_cpu; struct sparc_cpu_select { const char *string; - const char *name; - int set_tune_p; - int set_arch_p; + const char *const name; + const int set_tune_p; + const int set_arch_p; }; extern struct sparc_cpu_select sparc_select[]; @@ -1433,7 +1433,7 @@ extern enum reg_class sparc_regno_reg_class[]; extern char sparc_leaf_regs[]; #define LEAF_REGISTERS sparc_leaf_regs -extern char leaf_reg_remap[]; +extern const char leaf_reg_remap[]; #define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO]) /* The class value for index registers, and the one for base regs. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 959f2efa37c..a7a008f8def 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * class.c (build_vtable_entry_ref): Const-ify. + * decl.c (predefined_identifier, + initialize_predefined_identifiers): Likewise. + * init.c (build_new_1): Likewise. + * lex.c (cplus_tree_code_type, cplus_tree_code_length, resword): + Likewise. + 2001-10-05 Alexandre Oliva <aoliva@redhat.com> * optimize.c (struct inline_data): Moved to ../tree-inline.c. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ac71fc5baa5..97a35974102 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -435,7 +435,7 @@ static void build_vtable_entry_ref (basetype, idx) tree basetype, idx; { - static char asm_stmt[] = ".vtable_entry %c0, %c1"; + static const char asm_stmt[] = ".vtable_entry %c0, %c1"; tree s, i, i2; tree vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype)); tree first_fn = TYPE_BINFO_VTABLE (basetype); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0dfd8d65d32..60cceada0f7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6227,11 +6227,11 @@ record_unknown_type (type, name) typedef struct predefined_identifier { /* The name of the identifier. */ - const char *name; + const char *const name; /* The place where the IDENTIFIER_NODE should be stored. */ - tree *node; + tree *const node; /* Non-zero if this is the name of a constructor or destructor. */ - int ctor_or_dtor_p; + const int ctor_or_dtor_p; } predefined_identifier; /* Create all the predefined identifiers. */ @@ -6239,10 +6239,10 @@ typedef struct predefined_identifier static void initialize_predefined_identifiers () { - struct predefined_identifier *pid; + const predefined_identifier *pid; /* A table of identifiers to create at startup. */ - static predefined_identifier predefined_identifiers[] = { + static const predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, { "Java", &lang_name_java, 0 }, diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 487543e6386..8dad82d0711 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2355,7 +2355,7 @@ build_new_1 (exp) tree class_addr, alloc_decl; tree class_decl = build_java_class_ref (true_type); tree class_size = size_in_bytes (true_type); - static char alloc_name[] = "_Jv_AllocObject"; + static const char alloc_name[] = "_Jv_AllocObject"; use_java_new = 1; alloc_decl = IDENTIFIER_GLOBAL_VALUE (get_identifier (alloc_name)); if (alloc_decl == NULL_TREE) diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 6d8fcb36ad7..cb691420243 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -213,7 +213,7 @@ int interface_unknown; /* whether or not we know this class #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, -static char cplus_tree_code_type[] = { +static const char cplus_tree_code_type[] = { 'x', #include "cp-tree.def" }; @@ -225,7 +225,7 @@ static char cplus_tree_code_type[] = { #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, -static int cplus_tree_code_length[] = { +static const int cplus_tree_code_length[] = { 0, #include "cp-tree.def" }; @@ -390,9 +390,9 @@ init_operators () /* The reserved keyword table. */ struct resword { - const char *word; - ENUM_BITFIELD(rid) rid : 16; - unsigned int disable : 16; + const char *const word; + const ENUM_BITFIELD(rid) rid : 16; + const unsigned int disable : 16; }; /* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h index 8ee6a1fda5e..cda691d5956 100644 --- a/gcc/cppdefault.h +++ b/gcc/cppdefault.h @@ -96,11 +96,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ struct default_include { - const char *fname; /* The name of the directory. */ - const char *component; /* The component containing the directory + const char *const fname; /* The name of the directory. */ + const char *const component; /* The component containing the directory (see update_path in prefix.c) */ - int cplusplus; /* Only look here if we're compiling C++. */ - int cxx_aware; /* Includes in this directory don't need to + const int cplusplus; /* Only look here if we're compiling C++. */ + const int cxx_aware; /* Includes in this directory don't need to be wrapped in extern "C" when compiling C++. */ }; diff --git a/gcc/cppexp.c b/gcc/cppexp.c index e2ed7de4b8d..5a92351a03c 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -63,23 +63,23 @@ struct op struct suffix { - unsigned char s[4]; - unsigned char u; - unsigned char l; + const unsigned char s[4]; + const unsigned char u; + const unsigned char l; }; -const struct suffix vsuf_1[] = { +static const struct suffix vsuf_1[] = { { "u", 1, 0 }, { "U", 1, 0 }, { "l", 0, 1 }, { "L", 0, 1 } }; -const struct suffix vsuf_2[] = { +static const struct suffix vsuf_2[] = { { "ul", 1, 1 }, { "UL", 1, 1 }, { "uL", 1, 1 }, { "Ul", 1, 1 }, { "lu", 1, 1 }, { "LU", 1, 1 }, { "Lu", 1, 1 }, { "lU", 1, 1 }, { "ll", 0, 2 }, { "LL", 0, 2 } }; -const struct suffix vsuf_3[] = { +static const struct suffix vsuf_3[] = { { "ull", 1, 2 }, { "ULL", 1, 2 }, { "uLL", 1, 2 }, { "Ull", 1, 2 }, { "llu", 1, 2 }, { "LLU", 1, 2 }, { "LLu", 1, 2 }, { "llU", 1, 2 } }; diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 8c02b555374..74288f3612d 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,16 @@ +Sun Oct 7 12:27:54 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * bad.c (_ffebad_message_, ffebad_messages_): Const-ify. + * bld.c (ffebld_arity_op_): Likewise. + * bld.h (ffebld_arity_op_): Likewise. + * com.c (ffecom_init_0): Likewise. + * intdoc.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_, + _ffeintrin_imp_, names, gens, imps, specs, cc_pair, + cc_descriptions, cc_summaries): Likewise. + * intrin.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_, + _ffeintrin_imp_, ffeintrin_names_, ffeintrin_gens_, + ffeintrin_imps_, ffeintrin_specs_): Likewise. + 2001-10-05 Toon Moene <toon@moene.indiv.nluug.nl> * news.texi: Document libf2c being built as a shared library. diff --git a/gcc/f/bad.c b/gcc/f/bad.c index 0ecaf7484c5..aa0ae6a0b84 100644 --- a/gcc/f/bad.c +++ b/gcc/f/bad.c @@ -61,13 +61,13 @@ bool ffebad_is_inhibited_ = FALSE; struct _ffebad_message_ { - ffebadSeverity severity; - const char *message; + const ffebadSeverity severity; + const char *const message; }; /* Static objects accessed by functions in this module. */ -static struct _ffebad_message_ ffebad_messages_[] +static const struct _ffebad_message_ ffebad_messages_[] = { #define FFEBAD_MSGS1(KWD,SEV,MSG) { SEV, MSG }, diff --git a/gcc/f/bld.c b/gcc/f/bld.c index dd4c8603746..6d2247f30e7 100644 --- a/gcc/f/bld.c +++ b/gcc/f/bld.c @@ -46,7 +46,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Externals defined here. */ -ffebldArity ffebld_arity_op_[] +const ffebldArity ffebld_arity_op_[] = { #define FFEBLD_OP(KWD,NAME,ARITY) ARITY, diff --git a/gcc/f/bld.h b/gcc/f/bld.h index 3347b1cd92f..bee0480849e 100644 --- a/gcc/f/bld.h +++ b/gcc/f/bld.h @@ -480,7 +480,7 @@ struct _ffebld_pool_stack_ /* Global objects accessed by users of this module. */ -extern ffebldArity ffebld_arity_op_[]; +extern const ffebldArity ffebld_arity_op_[]; extern struct _ffebld_pool_stack_ ffebld_pool_stack_; /* Declare functions with prototypes. */ diff --git a/gcc/f/com.c b/gcc/f/com.c index 8d9ad8c217a..c086c489e1a 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -11386,16 +11386,16 @@ ffecom_init_0 () if (ffe_is_do_internal_checks ()) { - static char names[][12] + static const char names[][12] = {"bar", "bletch", "foo", "foobar"}; - char *name; + const char *name; unsigned long ul; double fl; name = bsearch ("foo", &names[0], ARRAY_SIZE (names), sizeof (names[0]), (int (*)(const void *, const void *)) strcmp); - if (name != (char *) &names[2]) + if (name != &names[0][2]) { assert ("bsearch doesn't work, #define FFEPROJ_BSEARCH 0 in proj.h" == NULL); diff --git a/gcc/f/intdoc.c b/gcc/f/intdoc.c index 63cfbadcec0..4ce776b004a 100644 --- a/gcc/f/intdoc.c +++ b/gcc/f/intdoc.c @@ -70,39 +70,39 @@ Usage: intdoc > intdoc.texi\n\ struct _ffeintrin_name_ { - const char *name_uc; - const char *name_lc; - const char *name_ic; - ffeintrinGen generic; - ffeintrinSpec specific; + const char *const name_uc; + const char *const name_lc; + const char *const name_ic; + const ffeintrinGen generic; + const ffeintrinSpec specific; }; struct _ffeintrin_gen_ { - const char *name; /* Name as seen in program. */ - ffeintrinSpec specs[2]; + const char *const name; /* Name as seen in program. */ + const ffeintrinSpec specs[2]; }; struct _ffeintrin_spec_ { - const char *name; /* Uppercase name as seen in source code, + const char *const name; /* Uppercase name as seen in source code, lowercase if no source name, "none" if no name at all (NONE case). */ - bool is_actualarg; /* Ok to pass as actual arg if -pedantic. */ - ffeintrinFamily family; - ffeintrinImp implementation; + const bool is_actualarg; /* Ok to pass as actual arg if -pedantic. */ + const ffeintrinFamily family; + const ffeintrinImp implementation; }; struct _ffeintrin_imp_ { - const char *name; /* Name of implementation. */ + const char *const name; /* Name of implementation. */ #if 0 /* FFECOM_targetCURRENT == FFECOM_targetGCC */ - ffecomGfrt gfrt; /* gfrt index in library. */ + const ffecomGfrt gfrt; /* gfrt index in library. */ #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ - const char *control; + const char *const control; }; -static struct _ffeintrin_name_ names[] = { +static const struct _ffeintrin_name_ names[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) \ { UPPER, LOWER, MIXED, FFEINTRIN_ ## GEN, FFEINTRIN_ ## SPEC }, #define DEFGEN(CODE,NAME,SPEC1,SPEC2) @@ -117,7 +117,7 @@ static struct _ffeintrin_name_ names[] = { #undef DEFIMPY }; -static struct _ffeintrin_gen_ gens[] = { +static const struct _ffeintrin_gen_ gens[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) #define DEFGEN(CODE,NAME,SPEC1,SPEC2) \ { NAME, { SPEC1, SPEC2, }, }, @@ -132,7 +132,7 @@ static struct _ffeintrin_gen_ gens[] = { #undef DEFIMPY }; -static struct _ffeintrin_imp_ imps[] = { +static const struct _ffeintrin_imp_ imps[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) #define DEFGEN(CODE,NAME,SPEC1,SPEC2) #define DEFSPEC(CODE,NAME,CALLABLE,FAMILY,IMP) @@ -157,7 +157,7 @@ static struct _ffeintrin_imp_ imps[] = { #undef DEFIMPY }; -static struct _ffeintrin_spec_ specs[] = { +static const struct _ffeintrin_spec_ specs[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) #define DEFGEN(CODE,NAME,SPEC1,SPEC2) #define DEFSPEC(CODE,NAME,CALLABLE,FAMILY,IMP) \ @@ -171,17 +171,17 @@ static struct _ffeintrin_spec_ specs[] = { #undef DEFIMPY }; -struct cc_pair { ffeintrinImp imp; const char *text; }; +struct cc_pair { const ffeintrinImp imp; const char *const text; }; static const char *descriptions[FFEINTRIN_imp] = { 0 }; -static struct cc_pair cc_descriptions[] = { +static const struct cc_pair cc_descriptions[] = { #define DEFDOC(IMP,SUMMARY,DESCRIPTION) { FFEINTRIN_imp ## IMP, DESCRIPTION }, #include "intdoc.h0" #undef DEFDOC }; static const char *summaries[FFEINTRIN_imp] = { 0 }; -static struct cc_pair cc_summaries[] = { +static const struct cc_pair cc_summaries[] = { #define DEFDOC(IMP,SUMMARY,DESCRIPTION) { FFEINTRIN_imp ## IMP, SUMMARY }, #include "intdoc.h0" #undef DEFDOC diff --git a/gcc/f/intrin.c b/gcc/f/intrin.c index 31ebd96f912..add9902fc73 100644 --- a/gcc/f/intrin.c +++ b/gcc/f/intrin.c @@ -32,39 +32,39 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct _ffeintrin_name_ { - const char *name_uc; - const char *name_lc; - const char *name_ic; - ffeintrinGen generic; - ffeintrinSpec specific; + const char *const name_uc; + const char *const name_lc; + const char *const name_ic; + const ffeintrinGen generic; + const ffeintrinSpec specific; }; struct _ffeintrin_gen_ { - const char *name; /* Name as seen in program. */ - ffeintrinSpec specs[2]; + const char *const name; /* Name as seen in program. */ + const ffeintrinSpec specs[2]; }; struct _ffeintrin_spec_ { - const char *name; /* Uppercase name as seen in source code, + const char *const name; /* Uppercase name as seen in source code, lowercase if no source name, "none" if no name at all (NONE case). */ - bool is_actualarg; /* Ok to pass as actual arg if -pedantic. */ - ffeintrinFamily family; - ffeintrinImp implementation; + const bool is_actualarg; /* Ok to pass as actual arg if -pedantic. */ + const ffeintrinFamily family; + const ffeintrinImp implementation; }; struct _ffeintrin_imp_ { - const char *name; /* Name of implementation. */ + const char *const name; /* Name of implementation. */ #if FFECOM_targetCURRENT == FFECOM_targetGCC - ffecomGfrt gfrt_direct; /* library routine, direct-callable form. */ - ffecomGfrt gfrt_f2c; /* library routine, f2c-callable form. */ - ffecomGfrt gfrt_gnu; /* library routine, gnu-callable form. */ + const ffecomGfrt gfrt_direct;/* library routine, direct-callable form. */ + const ffecomGfrt gfrt_f2c; /* library routine, f2c-callable form. */ + const ffecomGfrt gfrt_gnu; /* library routine, gnu-callable form. */ #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ - const char *control; - char y2kbad; + const char *const control; + const char y2kbad; }; static ffebad ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, @@ -77,7 +77,7 @@ static ffebad ffeintrin_check_ (ffeintrinImp imp, ffebldOp op, static bool ffeintrin_check_any_ (ffebld arglist); static int ffeintrin_cmp_name_ (const void *name, const void *intrinsic); -static struct _ffeintrin_name_ ffeintrin_names_[] +static const struct _ffeintrin_name_ ffeintrin_names_[] = { /* Alpha order. */ #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) \ @@ -94,7 +94,7 @@ static struct _ffeintrin_name_ ffeintrin_names_[] #undef DEFIMPY }; -static struct _ffeintrin_gen_ ffeintrin_gens_[] +static const struct _ffeintrin_gen_ ffeintrin_gens_[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) @@ -111,7 +111,7 @@ static struct _ffeintrin_gen_ ffeintrin_gens_[] #undef DEFIMPY }; -static struct _ffeintrin_imp_ ffeintrin_imps_[] +static const struct _ffeintrin_imp_ ffeintrin_imps_[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) @@ -140,7 +140,7 @@ static struct _ffeintrin_imp_ ffeintrin_imps_[] #undef DEFIMPY }; -static struct _ffeintrin_spec_ ffeintrin_specs_[] +static const struct _ffeintrin_spec_ ffeintrin_specs_[] = { #define DEFNAME(UPPER,LOWER,MIXED,GEN,SPEC) diff --git a/gcc/flow.c b/gcc/flow.c index a0ea335faee..98b3e4919ee 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -417,7 +417,7 @@ life_analysis (f, file, flags) { #ifdef ELIMINABLE_REGS register int i; - static struct {int from, to; } eliminables[] = ELIMINABLE_REGS; + static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS; #endif /* Record which registers will be eliminated. We use this in diff --git a/gcc/gcc.c b/gcc/gcc.c index cabbe18c902..b740218ca2a 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -122,7 +122,7 @@ extern int getrusage PARAMS ((int, struct rusage *)); #endif /* DIR_UP */ #endif /* VMS */ -static char dir_separator_str[] = { DIR_SEPARATOR, 0 }; +static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -226,11 +226,11 @@ static const char *cross_compile = "0"; switch. The only case we support now is simply appending or deleting a string to or from the end of the first part of the configuration name. */ -struct modify_target +const struct modify_target { - const char *sw; - enum add_del {ADD, DELETE} add_del; - const char *str; + const char *const sw; + const enum add_del {ADD, DELETE} add_del; + const char *const str; } modify_target[] = MODIFY_TARGET_NAME; #endif @@ -857,21 +857,21 @@ static char **preprocessor_options; struct option_map { /* The long option's name. */ - const char *name; + const char *const name; /* The equivalent short option. */ - const char *equivalent; + const char *const equivalent; /* Argument info. A string of flag chars; NULL equals no options. a => argument required. o => argument optional. j => join argument to equivalent, making one word. * => require other text after NAME as an argument. */ - const char *arg_info; + const char *const arg_info; }; /* This is the table of mappings. Mappings are tried sequentially for each option encountered; the first one that matches, wins. */ -struct option_map option_map[] = +static const struct option_map option_map[] = { {"--all-warnings", "-Wall", 0}, {"--ansi", "-ansi", 0}, @@ -954,9 +954,9 @@ struct option_map option_map[] = #ifdef TARGET_OPTION_TRANSLATE_TABLE -static struct { - const char *option_found; - const char *replacements; +static const struct { + const char *const option_found; + const char *const replacements; } target_option_translations[] = { TARGET_OPTION_TRANSLATE_TABLE, @@ -1361,11 +1361,11 @@ static struct spec_list static_specs[] = That is all that the EXTRA_SPECS macro gives us. */ struct spec_list_1 { - const char *name; - const char *ptr; + const char *const name; + const char *const ptr; }; -static struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; +static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; static struct spec_list *extra_specs = (struct spec_list *) 0; #endif @@ -1519,7 +1519,7 @@ init_spec () #ifdef USE_AS_TRADITIONAL_FORMAT /* Prepend "--traditional-format" to whatever asm_spec we had before. */ { - static char tf[] = "--traditional-format "; + static const char tf[] = "--traditional-format "; obstack_grow (&obstack, tf, sizeof(tf) - 1); obstack_grow0 (&obstack, asm_spec, strlen (asm_spec)); asm_spec = obstack_finish (&obstack); diff --git a/gcc/gcov.c b/gcc/gcov.c index b88bf093fc0..db51a8b6022 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -79,7 +79,7 @@ typedef HOST_WIDEST_INT gcov_type; /* The functions in this file for creating and solution program flow graphs are very similar to functions in the gcc source file profile.c. */ -char gcov_version_string[] = "GNU gcov version 1.5\n"; +static const char gcov_version_string[] = "GNU gcov version 1.5\n"; /* This is the size of the buffer used to read in source file lines. */ diff --git a/gcc/genattr.c b/gcc/genattr.c index cbb1175ceee..be86ca68b14 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -145,19 +145,19 @@ write_units (num_units, multiplicity, simultaneity, printf ("#define INSN_SCHEDULING\n\n"); printf ("extern int result_ready_cost PARAMS ((rtx));\n"); printf ("extern int function_units_used PARAMS ((rtx));\n\n"); - printf ("extern struct function_unit_desc\n"); + printf ("extern const struct function_unit_desc\n"); printf ("{\n"); - printf (" const char *name;\n"); - printf (" int bitmask;\n"); - printf (" int multiplicity;\n"); - printf (" int simultaneity;\n"); - printf (" int default_cost;\n"); - printf (" int max_issue_delay;\n"); - printf (" int (*ready_cost_function) PARAMS ((rtx));\n"); - printf (" int (*conflict_cost_function) PARAMS ((rtx, rtx));\n"); - printf (" int max_blockage;\n"); - printf (" unsigned int (*blockage_range_function) PARAMS ((rtx));\n"); - printf (" int (*blockage_function) PARAMS ((rtx, rtx));\n"); + printf (" const char *const name;\n"); + printf (" const int bitmask;\n"); + printf (" const int multiplicity;\n"); + printf (" const int simultaneity;\n"); + printf (" const int default_cost;\n"); + printf (" const int max_issue_delay;\n"); + printf (" int (*const ready_cost_function) PARAMS ((rtx));\n"); + printf (" int (*const conflict_cost_function) PARAMS ((rtx, rtx));\n"); + printf (" const int max_blockage;\n"); + printf (" unsigned int (*const blockage_range_function) PARAMS ((rtx));\n"); + printf (" int (*const blockage_function) PARAMS ((rtx, rtx));\n"); printf ("} function_units[];\n\n"); printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units); printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min); diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 071dd54c8f8..276d515a2c6 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -2448,8 +2448,8 @@ make_length_attrs () static const char *const new_names[] = {"*insn_default_length", "*insn_variable_length_p", "*insn_current_length"}; - static rtx (*no_address_fn[]) PARAMS ((rtx)) = {identity_fn, zero_fn, zero_fn}; - static rtx (*address_fn[]) PARAMS ((rtx)) = {max_fn, one_fn, identity_fn}; + static rtx (*const no_address_fn[]) PARAMS ((rtx)) = {identity_fn, zero_fn, zero_fn}; + static rtx (*const address_fn[]) PARAMS ((rtx)) = {max_fn, one_fn, identity_fn}; size_t i; struct attr_desc *length_attr, *new_attr; struct attr_value *av, *new_av; @@ -5657,7 +5657,7 @@ write_function_unit_info () the function units. The name is included for documentation purposes only. */ - printf ("struct function_unit_desc function_units[] = {\n"); + printf ("const struct function_unit_desc function_units[] = {\n"); /* Write out the descriptions in numeric order, but don't force that order on the list. Doing so increases the runtime of genattrtab.c. */ diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index da2b8831356..eb3e32728cf 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -95,12 +95,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct rtx_definition { - const char *enumname, *name, *format; + const char *const enumname, *const name, *const format; }; #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { STRINGX(ENUM), NAME, FORMAT }, -struct rtx_definition defs[] = +const struct rtx_definition defs[] = { #include "rtl.def" /* rtl expressions are documented here */ }; diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 12a1b51f299..f4ba1f90a44 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -34,9 +34,9 @@ static void output_predicate_decls () { #ifdef PREDICATE_CODES - static struct { - const char *name; - RTX_CODE codes[NUM_RTX_CODE]; + static const struct { + const char *const name; + const RTX_CODE codes[NUM_RTX_CODE]; } predicate[] = { PREDICATE_CODES }; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index c453b1aeb2e..08ef3b4ac8d 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -181,10 +181,10 @@ static int error_count; of tree nodes. Also, if a predicate can match only one code, we can hardwire that code into the node testing the predicate. */ -static struct pred_table +static const struct pred_table { - const char *name; - RTX_CODE codes[NUM_RTX_CODE]; + const char *const name; + const RTX_CODE codes[NUM_RTX_CODE]; } preds[] = { {"general_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM}}, diff --git a/gcc/global.c b/gcc/global.c index 8cc8729b789..f811f22b9c6 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -326,7 +326,7 @@ global_alloc (file) { int retval; #ifdef ELIMINABLE_REGS - static struct {int from, to; } eliminables[] = ELIMINABLE_REGS; + static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS; #endif int need_fp = (! flag_omit_frame_pointer diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 71fdf9251b4..5fbc60eda54 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * jcf-io.c (format_uint): Const-ify. + * lang.c (java_tree_code_type, java_tree_code_length): Likewise. + * lex.c (java_get_line_col): Likewise. + * parse.y (build_incdec): Likewise. + 2001-10-03 Alexandre Petit-Bianco <apbianco@redhat.com> * parse.y (patch_assignment): Use lvalue's original TYPE when diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index a2809767444..ba56b1806cd 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -625,7 +625,7 @@ DEFUN(format_uint, (buffer, value, base), /* Note this code does not pretend to be optimized. */ do { int digit = value % base; - static char digit_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + static const char digit_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; *--buf_ptr = digit_chars[digit]; value /= base; } while (value != 0); diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 482d89b1cd4..7fa23a910f3 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -67,7 +67,7 @@ static int process_option_with_no PARAMS ((char *, #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, -char java_tree_code_type[] = { +static const char java_tree_code_type[] = { 'x', #include "java-tree.def" }; @@ -79,7 +79,7 @@ char java_tree_code_type[] = { #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, -int java_tree_code_length[] = { +static const int java_tree_code_length[] = { 0, #include "java-tree.def" }; diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 926827ace8d..c2c4634a8a2 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -1751,7 +1751,7 @@ java_get_line_col (filename, line, col) c = getc (fp); if (c == EOF) { - static char msg[] = "<<file too short - unexpected EOF>>"; + static const char msg[] = "<<file too short - unexpected EOF>>"; obstack_grow (&temporary_obstack, msg, sizeof(msg)-1); goto have_line; } diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 6fa305486d4..2737579d536 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -14147,7 +14147,7 @@ build_incdec (op_token, op_location, op1, is_post_p) tree op1; int is_post_p; { - static enum tree_code lookup [2][2] = + static const enum tree_code lookup [2][2] = { { PREDECREMENT_EXPR, PREINCREMENT_EXPR, }, { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, }, diff --git a/gcc/lcm.c b/gcc/lcm.c index 95cc8fbdf80..62572b8c9d6 100644 --- a/gcc/lcm.c +++ b/gcc/lcm.c @@ -1016,7 +1016,7 @@ optimize_mode_switching (file) int need_commit = 0; sbitmap *kill; struct edge_list *edge_list; - static int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING; + static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING; #define N_ENTITIES (sizeof num_modes / sizeof (int)) int entity_map[N_ENTITIES]; struct bb_info *bb_info[N_ENTITIES]; diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index e0e8d812e65..6bc017586c4 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -2152,7 +2152,7 @@ find_free_reg (class, mode, qtyno, accept_call_clobbered, just_try_suggested, #endif HARD_REG_SET used, first_used; #ifdef ELIMINABLE_REGS - static struct {int from, to; } eliminables[] = ELIMINABLE_REGS; + static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS; #endif /* Validate our parameters. */ diff --git a/gcc/params.h b/gcc/params.h index 31455184e58..2d2619f5f40 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -45,11 +45,11 @@ typedef struct param_info { /* The name used with the `--param <name>=<value>' switch to set this value. */ - const char *option; + const char *const option; /* The associated value. */ int value; /* A short description of the option. */ - const char *help; + const char *const help; } param_info; /* An array containing the compiler parameters and their current diff --git a/gcc/predict.c b/gcc/predict.c index e15df721cd7..4c32ac0a7c7 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -69,10 +69,10 @@ static void counts_to_freqs PARAMS ((void)); Filled using information from predict.def. */ struct predictor_info { - const char *name; /* Name used in the debugging dumps. */ - int hitrate; /* Expected hitrate used by - predict_insn_def call. */ - int flags; + const char *const name; /* Name used in the debugging dumps. */ + const int hitrate; /* Expected hitrate used by + predict_insn_def call. */ + const int flags; }; /* Use given predictor without Dempster-Shaffer theory if it matches @@ -84,7 +84,7 @@ struct predictor_info #define HITRATE(VAL) ((int)((VAL) * REG_BR_PROB_BASE + 50) / 100) #define DEF_PREDICTOR(ENUM, NAME, HITRATE, FLAGS) {NAME, HITRATE, FLAGS}, -struct predictor_info predictor_info[] = { +static const struct predictor_info predictor_info[] = { #include "predict.def" /* Upper bound on predictors. */ diff --git a/gcc/protoize.c b/gcc/protoize.c index a0c1d197fc6..33388cf477b 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -167,8 +167,8 @@ static char * syscalls_absolute_filename; /* Type of the structure that holds information about macro unexpansions. */ struct unexpansion_struct { - const char *expanded; - const char *contracted; + const char *const expanded; + const char *const contracted; }; typedef struct unexpansion_struct unexpansion; diff --git a/gcc/real.c b/gcc/real.c index f525e69a62d..66ba3f08f17 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -5536,7 +5536,7 @@ read_expnt: /* Return Y = largest integer not greater than X (truncated toward minus infinity). */ -static UEMUSHORT bmask[] = +static const UEMUSHORT bmask[] = { 0xffff, 0xfffe, diff --git a/gcc/recog.h b/gcc/recog.h index 71b344ae549..ff96e47a944 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -215,15 +215,15 @@ typedef rtx (*insn_gen_fn) PARAMS ((rtx, ...)); struct insn_operand_data { - insn_operand_predicate_fn predicate; + const insn_operand_predicate_fn predicate; - const char *constraint; + const char *const constraint; - ENUM_BITFIELD(machine_mode) mode : 16; + const ENUM_BITFIELD(machine_mode) mode : 16; - char strict_low; + const char strict_low; - char eliminable; + const char eliminable; }; /* Legal values for insn_data.output_format. Indicate what type of data @@ -235,15 +235,15 @@ struct insn_operand_data struct insn_data { - const char *name; + const char *const name; const PTR output; - insn_gen_fn genfun; - const struct insn_operand_data *operand; + const insn_gen_fn genfun; + const struct insn_operand_data *const operand; - char n_operands; - char n_dups; - char n_alternatives; - char output_format; + const char n_operands; + const char n_dups; + const char n_alternatives; + const char output_format; }; extern const struct insn_data insn_data[]; diff --git a/gcc/regclass.c b/gcc/regclass.c index 963fbfed9cb..61119f3bf7b 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -74,7 +74,7 @@ HARD_REG_SET fixed_reg_set; /* Data for initializing the above. */ -static char initial_fixed_regs[] = FIXED_REGISTERS; +static const char initial_fixed_regs[] = FIXED_REGISTERS; /* Indexed by hard register number, contains 1 for registers that are fixed use or are clobbered by function calls. @@ -93,7 +93,7 @@ HARD_REG_SET losing_caller_save_reg_set; /* Data for initializing the above. */ -static char initial_call_used_regs[] = CALL_USED_REGISTERS; +static const char initial_call_used_regs[] = CALL_USED_REGISTERS; /* This is much like call_used_regs, except it doesn't have to be a superset of FIXED_REGISTERS. This vector indicates diff --git a/gcc/stmt.c b/gcc/stmt.c index 123c9d3c2b7..ddfbf24e0d7 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -3478,7 +3478,7 @@ expand_nl_goto_receiver () that if such an elimination is present, it can always be used. This is the case on all known machines; if we don't make this assumption, we do unnecessary saving on many machines. */ - static struct elims {int from, to;} elim_regs[] = ELIMINABLE_REGS; + static const struct elims {const int from, to;} elim_regs[] = ELIMINABLE_REGS; size_t i; for (i = 0; i < ARRAY_SIZE (elim_regs); i++) diff --git a/gcc/toplev.c b/gcc/toplev.c index dc3bf74945c..373c6f9995c 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -923,14 +923,14 @@ int align_functions; int align_functions_log; /* Table of supported debugging formats. */ -static struct +static const struct { - const char *arg; + const char *const arg; /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a constant expression, we use NO_DEBUG in its place. */ - enum debug_info_type debug_type; - int use_extensions_p; - const char *description; + const enum debug_info_type debug_type; + const int use_extensions_p; + const char *const description; } *da, debug_args[] = { @@ -1192,10 +1192,10 @@ lang_independent_options f_options[] = /* Table of language-specific options. */ -static struct lang_opt +static const struct lang_opt { - const char *option; - const char *description; + const char *const option; + const char *const description; } documented_lang_options[] = { @@ -1378,22 +1378,22 @@ documented_lang_options[] = If VALUE is negative, -VALUE is bits to clear. (The sign bit is not used so there is no confusion.) */ -struct +static const struct { - const char *name; - int value; - const char *description; + const char *const name; + const int value; + const char *const description; } target_switches [] = TARGET_SWITCHES; /* This table is similar, but allows the switch to have a value. */ #ifdef TARGET_OPTIONS -struct +static const struct { - const char *prefix; - const char **variable; - const char *description; + const char *const prefix; + const char **const variable; + const char *const description; } target_options [] = TARGET_OPTIONS; #endif diff --git a/gcc/tradcif.y b/gcc/tradcif.y index 771f9d2e25e..e59fd1e5b7c 100644 --- a/gcc/tradcif.y +++ b/gcc/tradcif.y @@ -285,15 +285,15 @@ parse_number (olen) } struct token { - const char *operator; - int token; + const char *const operator; + const int token; }; #ifndef NULL #define NULL 0 #endif -static struct token tokentab2[] = { +static const struct token tokentab2[] = { {"&&", AND}, {"||", OR}, {"<<", LSH}, @@ -313,7 +313,7 @@ yylex () register int c; register int namelen; register const char *tokstart; - register struct token *toktab; + register const struct token *toktab; retry: diff --git a/gcc/tree.h b/gcc/tree.h index def0e132ed5..56ed9aba617 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2099,12 +2099,12 @@ struct attribute_spec { /* The name of the attribute (without any leading or trailing __), or NULL to mark the end of a table of attributes. */ - const char *name; + const char *const name; /* The minimum length of the list of arguments of the attribute. */ - int min_length; + const int min_length; /* The maximum length of the list of arguments of the attribute (-1 for no maximum). */ - int max_length; + const int max_length; /* Whether this attribute requires a DECL. If it does, it will be passed from types of DECLs, function return types and array element types to the DECLs, function types and array types respectively; but when @@ -2112,15 +2112,15 @@ struct attribute_spec a warning. (If greater control is desired for a given attribute, this should be false, and the flags argument to the handler may be used to gain greater control in that case.) */ - bool decl_required; + const bool decl_required; /* Whether this attribute requires a type. If it does, it will be passed from a DECL to the type of that DECL. */ - bool type_required; + const bool type_required; /* Whether this attribute requires a function (or method) type. If it does, it will be passed from a function pointer type to the target type, and from a function return type (which is not itself a function pointer type) to the function type. */ - bool function_type_required; + const bool function_type_required; /* Function to handle this attribute. NODE points to the node to which the attribute is to be applied. If a DECL, it should be modified in place; if a TYPE, a copy should be created. NAME is the name of the @@ -2135,8 +2135,8 @@ struct attribute_spec otherwise the return value should be NULL_TREE. This pointer may be NULL if no special handling is required beyond the checks implied by the rest of this structure. */ - tree (*handler) PARAMS ((tree *node, tree name, tree args, - int flags, bool *no_add_attrs)); + tree (*const handler) PARAMS ((tree *node, tree name, tree args, + int flags, bool *no_add_attrs)); }; extern const struct attribute_spec default_target_attribute_table[]; |