From 68fee5e0afed307b1b456e994a4ef82915a7fbb6 Mon Sep 17 00:00:00 2001 From: ghazi Date: Fri, 20 Aug 1999 22:44:50 +0000 Subject: * machmode.h (mode_name): Constify a char*. * rtl.c (mode_name): Likewise. * genopinit.c (gen_insn): Use accessor macro, not `mode_name'. * optabs.c (init_libfuncs): Constify a char*. * print-tree.c (mode_name): Remove redundant declaration. (print_node): Use accessor macro, not `mode_name'. * reload1.c (dump_needs): Constify a char*. Use accessor macro, not `mode_name'. (new_spill_reg): Constify a char*. * tree.c (mode_name): Remove redundant declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28783 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 19 +++++++++++++++++++ gcc/genopinit.c | 14 +++++++------- gcc/machmode.h | 2 +- gcc/optabs.c | 2 +- gcc/print-tree.c | 6 ++---- gcc/reload1.c | 6 +++--- gcc/rtl.c | 2 +- gcc/tree.c | 2 -- 8 files changed, 34 insertions(+), 19 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6daf901a381..53b6b52cbb0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +Fri Aug 20 18:38:43 1999 Kaveh R. Ghazi + + * machmode.h (mode_name): Constify a char*. + + * rtl.c (mode_name): Likewise. + + * genopinit.c (gen_insn): Use accessor macro, not `mode_name'. + + * optabs.c (init_libfuncs): Constify a char*. + + * print-tree.c (mode_name): Remove redundant declaration. + (print_node): Use accessor macro, not `mode_name'. + + * reload1.c (dump_needs): Constify a char*. Use accessor macro, + not `mode_name'. + (new_spill_reg): Constify a char*. + + * tree.c (mode_name): Remove redundant declaration. + Fri Aug 20 18:31:26 1999 Kaveh R. Ghazi * rtl.c (rtx_name): Constify a char*. diff --git a/gcc/genopinit.c b/gcc/genopinit.c index 7394e562201..c9dd88d5fef 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -200,7 +200,7 @@ gen_insn (insn) CC modes (as it should be). */ for (i = ((int) MAX_MACHINE_MODE) - 1; i >= 0; i--) { - for (p = mode_name[i], q = np; *p; p++, q++) + for (p = GET_MODE_NAME(i), q = np; *p; p++, q++) if (tolower ((unsigned char)*p) != *q) break; @@ -213,9 +213,9 @@ gen_insn (insn) if (i < 0) matches = 0; else if (*pp == 'a') - m1 = i, np += strlen (mode_name[i]); + m1 = i, np += strlen (GET_MODE_NAME(i)); else - m2 = i, np += strlen (mode_name[i]); + m2 = i, np += strlen (GET_MODE_NAME(i)); force_int = force_float = 0; break; @@ -254,18 +254,18 @@ gen_insn (insn) case 'I': case 'F': case 'N': break; case 'a': - for (np = mode_name[m1]; *np; np++) + for (np = GET_MODE_NAME(m1); *np; np++) printf ("%c", tolower ((unsigned char)*np)); break; case 'b': - for (np = mode_name[m2]; *np; np++) + for (np = GET_MODE_NAME(m2); *np; np++) printf ("%c", tolower ((unsigned char)*np)); break; case 'A': - printf ("%smode", mode_name[m1]); + printf ("%smode", GET_MODE_NAME(m1)); break; case 'B': - printf ("%smode", mode_name[m2]); + printf ("%smode", GET_MODE_NAME(m2)); break; case 'c': printf ("%s", GET_RTX_NAME(op)); diff --git a/gcc/machmode.h b/gcc/machmode.h index 581400700ac..756559181ea 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -56,7 +56,7 @@ MAX_MACHINE_MODE }; /* Get the name of mode MODE as a string. */ -extern char *mode_name[]; +extern const char * const mode_name[]; #define GET_MODE_NAME(MODE) (mode_name[(int) (MODE)]) enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC, diff --git a/gcc/optabs.c b/gcc/optabs.c index 2de77e52f46..814a483fee4 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4450,7 +4450,7 @@ init_libfuncs (optable, first_mode, last_mode, opname, suffix) for (mode = first_mode; (int) mode <= (int) last_mode; mode = (enum machine_mode) ((int) mode + 1)) { - register char *mname = mode_name[(int) mode]; + register const char *mname = GET_MODE_NAME(mode); register unsigned mname_len = strlen (mname); register char *libfunc_name = (char *) xmalloc (2 + opname_len + mname_len + 1 + 1); diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 82e648dfd3e..55eb4c8a8b2 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -23,8 +23,6 @@ Boston, MA 02111-1307, USA. */ #include "system.h" #include "tree.h" -extern char *mode_name[]; - void print_node (); void indent_to (); @@ -389,7 +387,7 @@ print_node (file, prefix, node, indent) if (DECL_LANG_FLAG_7 (node)) fputs (" decl_7", file); - fprintf (file, " %s", mode_name[(int) mode]); + fprintf (file, " %s", GET_MODE_NAME(mode)); fprintf (file, " file %s line %d", DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); @@ -474,7 +472,7 @@ print_node (file, prefix, node, indent) fputs (" type_6", file); mode = TYPE_MODE (node); - fprintf (file, " %s", mode_name[(int) mode]); + fprintf (file, " %s", GET_MODE_NAME(mode)); print_node (file, "size", TYPE_SIZE (node), indent + 4); indent_to (file, indent + 3); diff --git a/gcc/reload1.c b/gcc/reload1.c index e4bda8b3169..edaa13f89d1 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -2031,7 +2031,7 @@ dump_needs (chain, dumpfile) struct insn_chain *chain; FILE *dumpfile; { - static char *reg_class_names[] = REG_CLASS_NAMES; + static const char * const reg_class_names[] = REG_CLASS_NAMES; int i; struct needs *n = &chain->need; @@ -2051,7 +2051,7 @@ dump_needs (chain, dumpfile) fprintf (dumpfile, ";; Need %d group%s (%smode) of class %s.\n", n->groups[i], n->groups[i] == 1 ? "" : "s", - mode_name[(int) chain->group_mode[i]], + GET_MODE_NAME(chain->group_mode[i]), reg_class_names[i]); } } @@ -2292,7 +2292,7 @@ new_spill_reg (chain, i, class, nongroup, dumpfile) if (TEST_HARD_REG_BIT (bad_spill_regs, regno)) { - static char *reg_class_names[] = REG_CLASS_NAMES; + static const char * const reg_class_names[] = REG_CLASS_NAMES; if (asm_noperands (PATTERN (chain->insn)) < 0) { diff --git a/gcc/rtl.c b/gcc/rtl.c index 39a72d53814..ae921537ca3 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -58,7 +58,7 @@ const char * const rtx_name[] = { #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) NAME, -char *mode_name[(int) MAX_MACHINE_MODE + 1] = { +const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = { #include "machmode.def" #ifdef EXTRA_CC_MODES diff --git a/gcc/tree.c b/gcc/tree.c index 1d96534ab6b..fb8f08a425b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -266,8 +266,6 @@ static void set_type_quals PROTO((tree, int)); static void append_random_chars PROTO((char *)); static void build_real_from_int_cst_1 PROTO((PTR)); -extern char *mode_name[]; - void gcc_obstack_init (); /* If non-null, a language specific helper for unsave_expr_now. */ -- cgit v1.2.1