From 27c38fbec7e6372600791cdb5d2dc7b0538f06d2 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Wed, 12 Sep 2001 17:18:03 +0000 Subject: [PATCH] c-common.c (c_tree_code_name): Const-ification. * c-common.c (c_tree_code_name): Const-ification. * c-decl.c (c_decode_option): Likewise. * c-typeck.c (warn_for_assignment): Likewise. * collect2.c (libexts, is_ctor_dtor, main, ignore_library): Likewise. * cppinit.c (output_deps): Likewise. * dependence.c (dependence_string, direction_string): Likewise. * dwarf2out.c (output_ranges): Likewise. * fixinc/fixfixes.c (emit_gnu_type): Likewise. * fixinc/gnu-regex.c (re_error_msgid): Likewise. * gcc.c (standard_exec_prefix, standard_exec_prefix_1, standard_startfile_prefix, standard_startfile_prefix_1, standard_startfile_prefix_2, tooldir_base_prefix, standard_bindir_prefix, find_a_file): Likewise. * genattrtab.c (make_length_attrs): Likewise. * gencheck.c (tree_codes): Likewise. * genemit.c (gen_split): Likewise. * genrecog.c (special_mode_pred_table): Likewise. * graph.c (graph_ext): Likewise. * protoize (default_include): Likewise. * reload.c (reload_when_needed_name): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * tlink.c (recompile_files): Likewise. * toplev.c (decode_g_option): Likewise. * tradcpp.c (output_deps): Likewise. * varasm.c (decode_reg_name): Likewise. * arm.c (arm_condition_codes, strings_fpa, thumb_condition_code): Const-ification. * arm.md: Likewise. * avr.c (avr_regnames, encode_section_info): Likewise. * c4x.c (float_reg_names): Likewise. * darwin.h (ASM_GLOBALIZE_LABEL): Likewise. * elfos.h (const_section): Likewise. * i386.c (ix86_comp_type_attributes): Likewise. * i386/win32.h (STRIP_NAME_ENCODING): Likewise. * ia64/aix.h (UNIQUE_SECTION): Likewise. * ia64.c (type_names): Likewise. * m68hc11.c (reg_class_names): Likewise. * m88k.c (m_options): Likewise. * mips.c (mips_output_conditional_branch, mips_unique_section): Likewise. * rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue, ultra_code_names): Likewise. * sparc.h (OVERRIDE_OPTIONS): Likewise. From-SVN: r45567 --- gcc/ChangeLog | 49 ++++++++++++++++++++++++++++++++++++ gcc/c-common.c | 2 +- gcc/c-decl.c | 2 +- gcc/c-typeck.c | 4 +-- gcc/collect2.c | 24 +++++++++--------- gcc/config/arm/arm.c | 6 ++--- gcc/config/arm/arm.h | 4 +-- gcc/config/arm/arm.md | 4 +-- gcc/config/avr/avr.c | 4 +-- gcc/config/c4x/c4x.c | 2 +- gcc/config/darwin.h | 2 +- gcc/config/elfos.h | 2 +- gcc/config/i386/i386.c | 2 +- gcc/config/i386/win32.h | 2 +- gcc/config/ia64/aix.h | 2 +- gcc/config/ia64/ia64.c | 2 +- gcc/config/m68hc11/m68hc11.c | 2 +- gcc/config/m88k/m88k.c | 2 +- gcc/config/mips/mips.c | 6 ++--- gcc/config/rs6000/sysv4.h | 2 +- gcc/config/sparc/sparc.c | 12 ++++----- gcc/config/sparc/sparc.h | 2 +- gcc/cppinit.c | 3 ++- gcc/dependence.c | 4 +-- gcc/dwarf2out.c | 2 +- gcc/fixinc/fixfixes.c | 2 +- gcc/fixinc/gnu-regex.c | 2 +- gcc/gcc.c | 17 +++++++------ gcc/genattrtab.c | 2 +- gcc/gencheck.c | 2 +- gcc/genemit.c | 6 ++--- gcc/genrecog.c | 2 +- gcc/graph.c | 2 +- gcc/protoize.c | 4 +-- gcc/reload.c | 2 +- gcc/sched-vis.c | 2 +- gcc/tlink.c | 2 +- gcc/toplev.c | 2 +- gcc/tradcpp.c | 2 +- gcc/varasm.c | 2 +- 40 files changed, 124 insertions(+), 75 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3af42a0fa812..edd2ad7375f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,52 @@ +2001-09-12 Kaveh R. Ghazi + + * c-common.c (c_tree_code_name): Const-ification. + * c-decl.c (c_decode_option): Likewise. + * c-typeck.c (warn_for_assignment): Likewise. + * collect2.c (libexts, is_ctor_dtor, main, ignore_library): + Likewise. + * cppinit.c (output_deps): Likewise. + * dependence.c (dependence_string, direction_string): Likewise. + * dwarf2out.c (output_ranges): Likewise. + * fixinc/fixfixes.c (emit_gnu_type): Likewise. + * fixinc/gnu-regex.c (re_error_msgid): Likewise. + * gcc.c (standard_exec_prefix, standard_exec_prefix_1, + standard_startfile_prefix, standard_startfile_prefix_1, + standard_startfile_prefix_2, tooldir_base_prefix, + standard_bindir_prefix, find_a_file): Likewise. + * genattrtab.c (make_length_attrs): Likewise. + * gencheck.c (tree_codes): Likewise. + * genemit.c (gen_split): Likewise. + * genrecog.c (special_mode_pred_table): Likewise. + * graph.c (graph_ext): Likewise. + * protoize (default_include): Likewise. + * reload.c (reload_when_needed_name): Likewise. + * sched-vis.c (visualize_stall_cycles): Likewise. + * tlink.c (recompile_files): Likewise. + * toplev.c (decode_g_option): Likewise. + * tradcpp.c (output_deps): Likewise. + * varasm.c (decode_reg_name): Likewise. + + * arm.c (arm_condition_codes, strings_fpa, thumb_condition_code): + Const-ification. + * arm.md: Likewise. + * avr.c (avr_regnames, encode_section_info): Likewise. + * c4x.c (float_reg_names): Likewise. + * darwin.h (ASM_GLOBALIZE_LABEL): Likewise. + * elfos.h (const_section): Likewise. + * i386.c (ix86_comp_type_attributes): Likewise. + * i386/win32.h (STRIP_NAME_ENCODING): Likewise. + * ia64/aix.h (UNIQUE_SECTION): Likewise. + * ia64.c (type_names): Likewise. + * m68hc11.c (reg_class_names): Likewise. + * m88k.c (m_options): Likewise. + * mips.c (mips_output_conditional_branch, mips_unique_section): + Likewise. + * rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise. + * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue, + ultra_code_names): Likewise. + * sparc.h (OVERRIDE_OPTIONS): Likewise. + 2001-09-12 Jakub Jelinek * configure.in (gcc_cv_as_shf_merge): Fix a typo. diff --git a/gcc/c-common.c b/gcc/c-common.c index 91f4b0acaf78..755e526d1b16 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4074,7 +4074,7 @@ static int c_tree_code_length[] = { Used for printing out the tree and error messages. */ #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, -static const char *c_tree_code_name[] = { +static const char *const c_tree_code_name[] = { "@@dummy", #include "c-common.def" }; diff --git a/gcc/c-decl.c b/gcc/c-decl.c index af61377aa42d..d0beb0f69268 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -490,7 +490,7 @@ c_decode_option (argc, argv) -std=gnu89 default, iso9899:1990 + gnu extensions -std=gnu99 iso9899:1999 + gnu extensions */ - const char *argstart = &p[5]; + const char *const argstart = &p[5]; if (!strcmp (argstart, "iso9899:1990") || !strcmp (argstart, "c89")) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index e28fa399d27d..444a1042e3f7 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4319,7 +4319,7 @@ warn_for_assignment (msgid, opname, function, argnum) if (function) { /* Function name is known; supply it. */ - const char *argstring = _("passing arg %d of `%s'"); + const char *const argstring = _("passing arg %d of `%s'"); new_opname = (char *) alloca (IDENTIFIER_LENGTH (function) + strlen (argstring) + 1 + 25 /*%d*/ + 1); @@ -4329,7 +4329,7 @@ warn_for_assignment (msgid, opname, function, argnum) else { /* Function name unknown (call through ptr); just give arg number.*/ - const char *argnofun = _("passing arg %d of pointer to function"); + const char *const argnofun = _("passing arg %d of pointer to function"); new_opname = (char *) alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1); sprintf (new_opname, argnofun, argnum); } diff --git a/gcc/collect2.c b/gcc/collect2.c index 3405f6ed1077..44f7e3a3901e 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -264,7 +264,7 @@ static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */ static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs, &libpath_lib_dirs, NULL}; -static const char *libexts[3] = {"a", "so", NULL}; /* possible library extentions */ +static const char *const libexts[3] = {"a", "so", NULL}; /* possible library extentions */ #endif static void handler PARAMS ((int)); @@ -557,7 +557,7 @@ static int is_ctor_dtor (s) const char *s; { - struct names { const char *name; int len; int ret; int two_underscores; }; + struct names { const char *const name; int len; int ret; int two_underscores; }; register struct names *p; register int ch; @@ -796,21 +796,21 @@ main (argc, argv) int argc; char *argv[]; { - const char *ld_suffix = "ld"; + const char *const ld_suffix = "ld"; const char *full_ld_suffix = ld_suffix; - const char *real_ld_suffix = "real-ld"; - const char *collect_ld_suffix = "collect-ld"; - const char *nm_suffix = "nm"; + const char *const real_ld_suffix = "real-ld"; + const char *const collect_ld_suffix = "collect-ld"; + const char *const nm_suffix = "nm"; const char *full_nm_suffix = nm_suffix; - const char *gnm_suffix = "gnm"; + const char *const gnm_suffix = "gnm"; const char *full_gnm_suffix = gnm_suffix; #ifdef LDD_SUFFIX - const char *ldd_suffix = LDD_SUFFIX; + const char *const ldd_suffix = LDD_SUFFIX; const char *full_ldd_suffix = ldd_suffix; #endif - const char *strip_suffix = "strip"; + const char *const strip_suffix = "strip"; const char *full_strip_suffix = strip_suffix; - const char *gstrip_suffix = "gstrip"; + const char *const gstrip_suffix = "gstrip"; const char *full_gstrip_suffix = gstrip_suffix; const char *arg; FILE *outf; @@ -2907,7 +2907,7 @@ if (debug) fprintf (stderr, "found: %s\n", lib_buf); /* Array of standard AIX libraries which should not be scanned for ctors/dtors. */ -static const char *aix_std_libs[] = { +static const char *const aix_std_libs[] = { "/unix", "/lib/libc.a", "/lib/libm.a", @@ -2931,7 +2931,7 @@ static int ignore_library (name) const char *name; { - const char **p = &aix_std_libs[0]; + const char *const *p = &aix_std_libs[0]; while (*p++ != NULL) if (! strcmp (name, *p)) return 1; return 0; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 725864c54a01..4445583f777b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -283,7 +283,7 @@ rtx arm_target_insn; int arm_target_label; /* The condition codes of the ARM, and the inverse function. */ -const char * arm_condition_codes[] = +const char *const arm_condition_codes[] = { "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "al", "nv" @@ -2834,7 +2834,7 @@ arm_adjust_cost (insn, link, dep, cost) static int fpa_consts_inited = 0; -static const char * strings_fpa[8] = +static const char *const strings_fpa[8] = { "0", "1", "2", "3", "4", "5", "0.5", "10" @@ -10609,7 +10609,7 @@ thumb_condition_code (x, invert) rtx x; int invert; { - static const char * conds[] = + static const char *const conds[] = { "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le" diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 784f28fac396..a3cc4f31b8c5 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -61,7 +61,7 @@ typedef enum arm_cond_code arm_cc; extern arm_cc arm_current_cc; -extern const char * arm_condition_codes[]; +extern const char *const arm_condition_codes[]; #define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1)) @@ -2800,7 +2800,7 @@ extern int making_const_table; do \ { \ int mi_delta = (DELTA); \ - const char * mi_op = mi_delta < 0 ? "sub" : "add"; \ + const char *const mi_op = mi_delta < 0 ? "sub" : "add"; \ int shift = 0; \ int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) \ ? 1 : 0); \ diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 5565aeeaf1ff..347bc33b0b65 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -7371,7 +7371,7 @@ "TARGET_ARM" "* { - const char * opcodes[4][2] = + static const char *const opcodes[4][2] = { {\"cmp\\t%2, %3\;cmp%d5\\t%0, %1\", \"cmp\\t%0, %1\;cmp%d4\\t%2, %3\"}, @@ -7406,7 +7406,7 @@ "TARGET_ARM" "* { - const char * opcodes[4][2] = + static const char *const opcodes[4][2] = { {\"cmp\\t%0, %1\;cmp%D4\\t%2, %3\", \"cmp\\t%2, %3\;cmp%D5\\t%0, %1\"}, diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index cb222b2b10f2..a6cb331e1b7e 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -77,7 +77,7 @@ rtx zero_reg_rtx; rtx ldi_reg_rtx; /* AVR register names {"r0", "r1", ..., "r31"} */ -const char * avr_regnames[] = REGISTER_NAMES; +static const char *const avr_regnames[] = REGISTER_NAMES; /* This holds the last insn address. */ static int last_insn_address = 0; @@ -4756,7 +4756,7 @@ encode_section_info (decl) && TREE_CODE (decl) == VAR_DECL && avr_progmem_p (decl)) { - const char *dsec = ".progmem.data"; + const char *const dsec = ".progmem.data"; DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec); TREE_READONLY (decl) = 1; } diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 2e7917745c80..872cdfd65a35 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -65,7 +65,7 @@ rtx floatunshihf2_libfunc; static int c4x_leaf_function; -static const char *float_reg_names[] = FLOAT_REGISTER_NAMES; +static const char *const float_reg_names[] = FLOAT_REGISTER_NAMES; /* Array of the smallest class containing reg number REGNO, indexed by REGNO. Used by REGNO_REG_CLASS in c4x.h. We assume that all these diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 5c49d1131932..72c689bd69b2 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -669,7 +669,7 @@ void alias_section (name, alias) \ #undef ASM_GLOBALIZE_LABEL #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - do { const char* _x = (NAME); if (!!strncmp (_x, "_OBJC_", 6)) { \ + do { const char *const _x = (NAME); if (!!strncmp (_x, "_OBJC_", 6)) { \ (fputs (".globl ", FILE), assemble_name (FILE, _x), fputs ("\n", FILE)); \ }} while (0) diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h index d2ae669a83ff..66b0db7e8e33 100644 --- a/gcc/config/elfos.h +++ b/gcc/config/elfos.h @@ -313,7 +313,7 @@ const_section () \ const char *name; \ char *string; \ const char *prefix; \ - static const char *prefixes[4][2] = \ + static const char *const prefixes[4][2] = \ { \ { ".text.", ".gnu.linkonce.t." }, \ { ".rodata.", ".gnu.linkonce.r." }, \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index eba47bcb72f5..81058acb116d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1124,7 +1124,7 @@ ix86_comp_type_attributes (type1, type2) tree type2; { /* Check for mismatch of non-default calling convention. */ - const char *rtdstr = TARGET_RTD ? "cdecl" : "stdcall"; + const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall"; if (TREE_CODE (type1) != FUNCTION_TYPE) return 1; diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h index d2ab075f774d..fda26586b2bb 100644 --- a/gcc/config/i386/win32.h +++ b/gcc/config/i386/win32.h @@ -145,7 +145,7 @@ while (0) #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ const char *_p; \ - const char *_name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*')); \ + const char *const _name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'));\ for (_p = _name; *_p && *_p != '@'; ++_p) \ ; \ if (*_p == '@') \ diff --git a/gcc/config/ia64/aix.h b/gcc/config/ia64/aix.h index 0c632111b5ad..8366824a79c9 100644 --- a/gcc/config/ia64/aix.h +++ b/gcc/config/ia64/aix.h @@ -204,7 +204,7 @@ extern unsigned int ia64_section_threshold; const char *name; \ char *string; \ const char *prefix; \ - static const char *prefixes[/*4*/3][2] = \ + static const char *const prefixes[/*4*/3][2] = \ { \ { ".text.", ".gnu.linkonce.t." }, \ { ".rodata.", ".gnu.linkonce.r." }, \ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ea1cf10d008a..c173b54a5c45 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -5079,7 +5079,7 @@ static struct ia64_packet packets[NR_PACKETS]; /* Map attr_type to a string with the name. */ -static const char *type_names[] = +static const char *const type_names[] = { "UNKNOWN", "A", "I", "M", "F", "B", "L", "X", "S" }; diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 04516fe4c153..3bd9ce68fb20 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -301,7 +301,7 @@ m68hc11_conditional_register_usage () /* Reload and register operations. */ -static const char *reg_class_names[] = REG_CLASS_NAMES; +static const char *const reg_class_names[] = REG_CLASS_NAMES; void diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 34ca9140e3b0..994994b8f41b 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -1534,7 +1534,7 @@ output_option (file, sep, type, name, indent, pos, max) return pos + fprintf (file, "%s%s%s", sep, type, name); } -static struct { const char *name; int value; } m_options[] = TARGET_SWITCHES; +static struct { const char *const name; int value; } m_options[] = TARGET_SWITCHES; static void output_options (file, f_options, f_len, W_options, W_len, diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index d54854ad42db..5ac7be10fe1f 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9445,9 +9445,9 @@ mips_output_conditional_branch (insn, operand. */ const char *op2 = (two_operands_p ? ",%z3" : ",%."); /* The operand-printing string for the comparison. */ - const char *comp = (float_p ? "%F0" : "%C0"); + const char *const comp = (float_p ? "%F0" : "%C0"); /* The operand-printing string for the inverted comparison. */ - const char *inverted_comp = (float_p ? "%W0" : "%N0"); + const char *const inverted_comp = (float_p ? "%W0" : "%N0"); /* The MIPS processors (for levels of the ISA at least two), have "likely" variants of each branch instruction. These instructions @@ -9801,7 +9801,7 @@ mips_unique_section (decl, reloc) int len, size, sec; const char *name, *prefix; char *string; - static const char *prefixes[4][2] = { + static const char *const prefixes[4][2] = { { ".text.", ".gnu.linkonce.t." }, { ".rodata.", ".gnu.linkonce.r." }, { ".data.", ".gnu.linkonce.d." }, diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 1b2051d82c4f..38fcb83458b5 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -630,7 +630,7 @@ extern int rs6000_pic_labelno; #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ do { \ - const char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \ + const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \ \ if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \ && uses_TOC()) \ diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 91deb4903d28..3b11a3f53d1b 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -6701,8 +6701,8 @@ sparc_flat_function_prologue (file, size) if (size > 0) { unsigned int reg_offset = current_frame_info.reg_offset; - const char *fp_str = reg_names[FRAME_POINTER_REGNUM]; - const char *t1_str = "%g1"; + const char *const fp_str = reg_names[FRAME_POINTER_REGNUM]; + const char *const t1_str = "%g1"; /* Things get a little tricky if local variables take up more than ~4096 bytes and outgoing arguments take up more than ~4096 bytes. When that @@ -6885,9 +6885,9 @@ sparc_flat_function_epilogue (file, size) { unsigned HOST_WIDE_INT reg_offset = current_frame_info.reg_offset; unsigned HOST_WIDE_INT size1; - const char *sp_str = reg_names[STACK_POINTER_REGNUM]; - const char *fp_str = reg_names[FRAME_POINTER_REGNUM]; - const char *t1_str = "%g1"; + const char *const sp_str = reg_names[STACK_POINTER_REGNUM]; + const char *const fp_str = reg_names[FRAME_POINTER_REGNUM]; + const char *const t1_str = "%g1"; /* In the reload sequence, we don't need to fill the load delay slots for most of the loads, also see if we can fill the final @@ -7380,7 +7380,7 @@ enum ultra_code { NONE=0, /* no insn at all */ static enum ultra_code ultra_code_from_mask PARAMS ((int)); static void ultra_schedule_insn PARAMS ((rtx *, rtx *, int, enum ultra_code)); -static const char *ultra_code_names[NUM_ULTRA_CODES] = { +static const char *const ultra_code_names[NUM_ULTRA_CODES] = { "NONE", "IEU0", "IEU1", "IEUN", "LSU", "CTI", "FPM", "FPA", "SINGLE" }; diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 629286ed9126..9835881afc33 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -400,7 +400,7 @@ Unrecognized value in TARGET_CPU_DEFAULT. { \ if (flag_pic) \ { \ - const char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";\ + const char *const pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";\ warning ("%s and profiling conflict: disabling %s", \ pic_string, pic_string); \ flag_pic = 0; \ diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 8029746bab1e..238cab4471b5 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -1032,7 +1032,8 @@ output_deps (pfile) { /* Stream on which to print the dependency information. */ FILE *deps_stream = 0; - const char *deps_mode = CPP_OPTION (pfile, print_deps_append) ? "a" : "w"; + const char *const deps_mode = + CPP_OPTION (pfile, print_deps_append) ? "a" : "w"; if (CPP_OPTION (pfile, deps_file) == 0) deps_stream = stdout; diff --git a/gcc/dependence.c b/gcc/dependence.c index 4bac69436511..5b1017eea312 100644 --- a/gcc/dependence.c +++ b/gcc/dependence.c @@ -61,11 +61,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA enum dependence_type {dt_flow, dt_anti, dt_output, dt_none}; #if 0 -static const char * dependence_string [] = {"flow", "anti", "output", "none"}; +static const char *const dependence_string [] = {"flow", "anti", "output", "none"}; #endif enum direction_type {lt, le, eq, gt, ge, star, independent, undef}; #if 0 -static const char * direction_string [] = {"<", "<=", "=", ">", ">=", "*", +static const char *const direction_string [] = {"<", "<=", "=", ">", ">=", "*", "INDEPENDENT", "UNDEFINED"}; #endif enum def_use_type {def, use, init_def_use}; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 739e62970247..d61f77fd958d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6508,7 +6508,7 @@ static void output_ranges () { register unsigned i; - const char *start_fmt = "Offset 0x%x"; + const char *const start_fmt = "Offset 0x%x"; const char *fmt = start_fmt; for (i = 0; i < ranges_table_in_use; ++i) diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c index afdecfc9e08e..a58c927a6845 100644 --- a/gcc/fixinc/fixfixes.c +++ b/gcc/fixinc/fixfixes.c @@ -164,7 +164,7 @@ emit_gnu_type ( text, rm ) typedef __%s_TYPE__ %s_t;\n\ #endif\n"; - const char* pz_guard = (strcmp (z_type, "wchar") == 0) + const char *const pz_guard = (strcmp (z_type, "wchar") == 0) ? " && ! defined(__cplusplus)" : ""; printf (z_fmt, z_TYPE, pz_guard, z_TYPE, z_TYPE, z_type); diff --git a/gcc/fixinc/gnu-regex.c b/gcc/fixinc/gnu-regex.c index 99786e2d49db..c4a8244696e6 100644 --- a/gcc/fixinc/gnu-regex.c +++ b/gcc/fixinc/gnu-regex.c @@ -947,7 +947,7 @@ weak_alias (__re_set_syntax, re_set_syntax) POSIX doesn't require that we do anything for REG_NOERROR, but why not be nice? */ -static const char *re_error_msgid[] = +static const char *const re_error_msgid[] = { gettext_noop ("Success"), /* REG_NOERROR */ gettext_noop ("No match"), /* REG_NOMATCH */ diff --git a/gcc/gcc.c b/gcc/gcc.c index cbf62f81b5a7..99a6c3dd5351 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1280,20 +1280,20 @@ static const char *gcc_exec_prefix; #define STANDARD_BINDIR_PREFIX "/usr/local/bin" #endif -static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX; -static const char *standard_exec_prefix_1 = "/usr/lib/gcc/"; +static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; +static const char *const standard_exec_prefix_1 = "/usr/lib/gcc/"; static const char *md_exec_prefix = MD_EXEC_PREFIX; static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; -static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; -static const char *standard_startfile_prefix_1 = "/lib/"; -static const char *standard_startfile_prefix_2 = "/usr/lib/"; +static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; +static const char *const standard_startfile_prefix_1 = "/lib/"; +static const char *const standard_startfile_prefix_2 = "/usr/lib/"; -static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX; +static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX; static const char *tooldir_prefix; -static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX; +static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; /* Subdirectory to use for locating libraries. Set by set_multilib_dir based on the compilation options. */ @@ -2436,7 +2436,8 @@ find_a_file (pprefix, name, mode) int mode; { char *temp; - const char *file_suffix = ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : ""); + const char *const file_suffix = + ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : ""); struct prefix_list *pl; int len = pprefix->max_len + strlen (name) + strlen (file_suffix) + 1; diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 3006ec81411b..071dd54c8f80 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -2445,7 +2445,7 @@ substitute_address (exp, no_address_fn, address_fn) static void make_length_attrs () { - static const char *new_names[] = {"*insn_default_length", + 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}; diff --git a/gcc/gencheck.c b/gcc/gencheck.c index 7eae8ec93240..b8fe254196ed 100644 --- a/gcc/gencheck.c +++ b/gcc/gencheck.c @@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define DEFTREECODE(SYM, NAME, TYPE, LEN) STRINGX(SYM), -const char *tree_codes[] = { +static const char *const tree_codes[] = { #include "tree.def" #include "c-common.def" #include "gencheck.h" diff --git a/gcc/genemit.c b/gcc/genemit.c index 644fe3892fc4..f4ad66f55661 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -558,12 +558,10 @@ gen_split (split) { register int i; int operands; - const char *name = "split"; + const char *const name = + ((GET_CODE (split) == DEFINE_PEEPHOLE2) ? "peephole2" : "split"); const char *unused; - if (GET_CODE (split) == DEFINE_PEEPHOLE2) - name = "peephole2"; - if (XVEC (split, 0) == 0) fatal ("define_%s (definition %d) lacks a pattern", name, insn_index_number); diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 448f40a8a3de..c453b1aeb2e7 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -216,7 +216,7 @@ static struct pred_table #define NUM_KNOWN_PREDS ARRAY_SIZE (preds) -static const char * special_mode_pred_table[] = { +static const char *const special_mode_pred_table[] = { #ifdef SPECIAL_MODE_PREDICATES SPECIAL_MODE_PREDICATES #endif diff --git a/gcc/graph.c b/gcc/graph.c index 462b6ab6a0f2..355816edd59f 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -31,7 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "graph.h" -static const char *graph_ext[] = +static const char *const graph_ext[] = { /* no_graph */ "", /* vcg */ ".vcg", diff --git a/gcc/protoize.c b/gcc/protoize.c index 98a0940c1724..63b69358e81a 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -205,8 +205,8 @@ static const int hash_mask = (HASH_TABLE_SIZE - 1); #define LOCAL_INCLUDE_DIR "/usr/local/include" #endif -struct default_include { const char *fname; - const char *component; +struct default_include { const char *const fname; + const char *const component; int x1, x2; } include_defaults[] #ifdef INCLUDE_DEFAULTS = INCLUDE_DEFAULTS; diff --git a/gcc/reload.c b/gcc/reload.c index ad4b4e858f67..99e4c6ec0273 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -6743,7 +6743,7 @@ regno_clobbered_p (regno, insn, mode, sets) return 0; } -static const char *reload_when_needed_name[] = +static const char *const reload_when_needed_name[] = { "RELOAD_FOR_INPUT", "RELOAD_FOR_OUTPUT", diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c index 90521a24703a..95aa8af768fe 100644 --- a/gcc/sched-vis.c +++ b/gcc/sched-vis.c @@ -905,7 +905,7 @@ void visualize_stall_cycles (stalls) int stalls; { - const char *prefix = ";; "; + const char *const prefix = ";; "; const char *suffix = "\n"; char *p; diff --git a/gcc/tlink.c b/gcc/tlink.c index d74e02661afe..4a669b46fd91 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -502,7 +502,7 @@ recompile_files () { char *line, *command; FILE *stream = fopen ((char*) f->root.key, "r"); - const char *outname = frob_extension ((char*) f->root.key, ".rnw"); + const char *const outname = frob_extension ((char*) f->root.key, ".rnw"); FILE *output = fopen (outname, "w"); while ((line = tfgets (stream)) != NULL) diff --git a/gcc/toplev.c b/gcc/toplev.c index 925f06b3cde7..d09dcca639fa 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4222,7 +4222,7 @@ decode_g_option (arg) -gdwarf -g3 is equivalent to -gdwarf3. */ static int type_explicitly_set_p = 0; /* Indexed by enum debug_info_type. */ - static const char *debug_type_names[] = + static const char *const debug_type_names[] = { "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff" }; diff --git a/gcc/tradcpp.c b/gcc/tradcpp.c index 69848860dc51..062d54e0e17b 100644 --- a/gcc/tradcpp.c +++ b/gcc/tradcpp.c @@ -1038,7 +1038,7 @@ output_deps () { /* Stream on which to print the dependency information. */ FILE *deps_stream = 0; - const char *deps_mode = deps_append ? "a" : "w"; + const char *const deps_mode = deps_append ? "a" : "w"; if (deps_file == 0) deps_stream = stdout; diff --git a/gcc/varasm.c b/gcc/varasm.c index defa0c6a4d8d..b4d4d6d07f90 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -747,7 +747,7 @@ decode_reg_name (asmspec) #ifdef ADDITIONAL_REGISTER_NAMES { - static struct { const char *name; int number; } table[] + static struct { const char *const name; int number; } table[] = ADDITIONAL_REGISTER_NAMES; for (i = 0; i < (int) ARRAY_SIZE (table); i++) -- 2.39.5