* print-rtl.c (print_rtx): Cast enums to int for comparison.
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Mar 2001 21:41:37 +0000 (21:41 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Mar 2001 21:41:37 +0000 (21:41 +0000)
* c-decl.c (grokdeclarator): Cast enums to int for comparison and
shifts.
* c-format.c (C_STD_VER): Cast to int for comparisons.
(check_function_format): Cast various enums to int for &.
(maybe_read_dollar_number): Likewise.
(check_format_info): Likewise.
(check_format_info_main): Likewise.
* expr.c (emit_move_insn_1): Cast enums to unsigned int for comparison.
(safe_from_p): Likewise.
* varasm.c (const_hash): Cast enum to int for %.
* emit-rtl.c (init_emit_once): Use int loop variable to work around
pcc enum problems with < and ++ operators.
* regclass.c (init_reg_sets_1): Cast enums for comparison.
(choose_hard_reg_mode): Use unsigned int to iterate over CCmodes.
(regclass_init): Change enum class to int to iterate over reg_classes.
* genrecog.c (merge_trees): Cast enums for comparison.
* rtl.h (GET_CODE): Cast to enum rtx_code.
(PUT_CODE): Cast to ENUM_BITFIELD(rtx_code).
(GET_MODE): Cast to enum machine_mode.
(PUT_MODE): Cast to ENUM_BITFIELD(machine_mode).
(GET_NOTE_INSN_NAME): Cast enum to int.
* tree.h (TREE_CODE): Cast to enum tree_code.
(TREE_SET_CODE): Cast VALUE to ENUM_BITFIELD(tree_code).
        * timevar.c (timevar_print): Change loop variable id from enum to
unsigned int.
* fixinc/fixincl.c (VLEVEL): Cast enums in comparison to unsigned int.
* config/i386/i386.md: Use PUT_MODE for mode assignment.
* toplev.c (compile_file): Cast enum DFI to int.
(decode_d_option): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40193 138bc75d-0d04-0410-961f-82ee72b054a4

15 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-format.c
gcc/config/i386/i386.md
gcc/emit-rtl.c
gcc/expr.c
gcc/fixinc/fixincl.c
gcc/genrecog.c
gcc/print-rtl.c
gcc/regclass.c
gcc/rtl.h
gcc/timevar.c
gcc/toplev.c
gcc/tree.h
gcc/varasm.c

index c3a7845..f64188d 100644 (file)
@@ -1,3 +1,36 @@
+2001-03-02  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * print-rtl.c (print_rtx): Cast enums to int for comparison.
+       * c-decl.c (grokdeclarator): Cast enums to int for comparison and
+       shifts.
+       * c-format.c (C_STD_VER): Cast to int for comparisons.
+       (check_function_format): Cast various enums to int for &.
+       (maybe_read_dollar_number): Likewise.
+       (check_format_info): Likewise.
+       (check_format_info_main): Likewise.
+       * expr.c (emit_move_insn_1): Cast enums to unsigned int for comparison.
+       (safe_from_p): Likewise.
+       * varasm.c (const_hash): Cast enum to int for %.
+       * emit-rtl.c (init_emit_once): Use int loop variable to work around
+       pcc enum problems with < and ++ operators.
+       * regclass.c (init_reg_sets_1): Cast enums for comparison.
+       (choose_hard_reg_mode): Use unsigned int to iterate over CCmodes.
+       (regclass_init): Change enum class to int to iterate over reg_classes.
+       * genrecog.c (merge_trees): Cast enums for comparison.
+       * rtl.h (GET_CODE): Cast to enum rtx_code.
+       (PUT_CODE): Cast to ENUM_BITFIELD(rtx_code).
+       (GET_MODE): Cast to enum machine_mode.
+       (PUT_MODE): Cast to ENUM_BITFIELD(machine_mode).
+       (GET_NOTE_INSN_NAME): Cast enum to int.
+       * tree.h (TREE_CODE): Cast to enum tree_code.
+       (TREE_SET_CODE): Cast VALUE to ENUM_BITFIELD(tree_code).
+        * timevar.c (timevar_print): Change loop variable id from enum to
+       unsigned int.
+       * fixinc/fixincl.c (VLEVEL): Cast enums in comparison to unsigned int.
+       * config/i386/i386.md: Use PUT_MODE for mode assignment.
+       * toplev.c (compile_file): Cast enum DFI to int.
+       (decode_d_option): Likewise.
+
 Fri Mar  2 12:18:13 2001  Christopher Faylor <cgf@cygnus.com>
 
        * cppinit.c (append_include_chain): Mark "after" include file name list
index c5420b0..f114ab5 100644 (file)
@@ -3929,9 +3929,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
       if (TREE_CODE (id) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (id))
        {
          enum rid i = C_RID_CODE (id);
-         if (i <= RID_LAST_MODIFIER)
+         if ((int) i <= (int) RID_LAST_MODIFIER)
            {
-             if (i == RID_LONG && specbits & (1<<i))
+             if (i == RID_LONG && (specbits & (1 << (int) i)))
                {
                  if (longlong)
                    error ("`long long long' is too long for GCC");
@@ -3943,9 +3943,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
                      longlong = 1;
                    }
                }
-             else if (specbits & (1 << i))
+             else if (specbits & (1 << (int) i))
                pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
-             specbits |= 1 << i;
+             specbits |= 1 << (int) i;
              goto found;
            }
        }
index 5adb8e5..b6270e2 100644 (file)
@@ -476,11 +476,11 @@ enum format_std_version
    or inheriting from, for the purpose of format features supported.  */
 #define CPLUSPLUS_STD_VER      STD_C89
 /* The C standard version we are checking formats against when pedantic.  */
-#define C_STD_VER              (c_language == clk_cplusplus              \
+#define C_STD_VER              ((int)(c_language == clk_cplusplus        \
                                 ? CPLUSPLUS_STD_VER                      \
                                 : (flag_isoc99                           \
                                    ? STD_C99                             \
-                                   : (flag_isoc94 ? STD_C94 : STD_C89)))
+                                   : (flag_isoc94 ? STD_C94 : STD_C89))))
 /* The name to give to the standard version we are warning about when
    pedantic.  FEATURE_VER is the version in which the feature warned out
    appeared, which is higher than C_STD_VER.  */
@@ -1105,7 +1105,8 @@ check_function_format (status, name, assembler_name, params)
          /* Yup; check it.  */
          check_format_info (status, info, params);
          if (warn_missing_format_attribute && info->first_arg_num == 0
-             && (format_types[info->format_type].flags & FMT_FLAG_ARG_CONVERT))
+             && (format_types[info->format_type].flags
+                 & (int) FMT_FLAG_ARG_CONVERT))
            {
              function_format_info *info2;
              for (info2 = function_format_list; info2; info2 = info2->next)
@@ -1298,7 +1299,7 @@ maybe_read_dollar_number (status, format, dollar_needed, params, param_ptr,
              nalloc - dollar_arguments_alloc);
       dollar_arguments_alloc = nalloc;
     }
-  if (!(fki->flags & FMT_FLAG_DOLLAR_MULTIPLE)
+  if (!(fki->flags & (int) FMT_FLAG_DOLLAR_MULTIPLE)
       && dollar_arguments_used[argnum - 1] == 1)
     {
       dollar_arguments_used[argnum - 1] = 2;
@@ -1434,7 +1435,7 @@ check_format_info (status, info, params)
       /* Functions taking a va_list normally pass a non-literal format
         string.  These functions typically are declared with
         first_arg_num == 0, so avoid warning in those cases.  */
-      if (!(format_types[info->format_type].flags & FMT_FLAG_ARG_CONVERT))
+      if (!(format_types[info->format_type].flags & (int) FMT_FLAG_ARG_CONVERT))
        {
          /* For strftime-like formats, warn for not checking the format
             string; but there are no arguments to check.  */
@@ -1746,7 +1747,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
        }
       flag_chars[0] = 0;
 
-      if ((fki->flags & FMT_FLAG_USE_DOLLAR) && has_operand_number != 0)
+      if ((fki->flags & (int) FMT_FLAG_USE_DOLLAR) && has_operand_number != 0)
        {
          /* Possibly read a $ operand number at the start of the format.
             If one was previously used, one is required here.  If one
@@ -1867,7 +1868,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
                  ++format_chars;
                }
              if (found_width && !non_zero_width_char &&
-                 (fki->flags & FMT_FLAG_ZERO_WIDTH_BAD))
+                 (fki->flags & (int) FMT_FLAG_ZERO_WIDTH_BAD))
                status_warning (status, "zero width in %s format",
                                fki->name);
              if (found_width)
@@ -1954,7 +1955,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
            }
          else
            {
-             if (!(fki->flags & FMT_FLAG_EMPTY_PREC_OK)
+             if (!(fki->flags & (int) FMT_FLAG_EMPTY_PREC_OK)
                  && !ISDIGIT (*format_chars))
                status_warning (status, "empty precision in %s format",
                                fki->name);
@@ -2025,7 +2026,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
        }
 
       /* Handle the scanf allocation kludge.  */
-      if (fki->flags & FMT_FLAG_SCANF_A_KLUDGE)
+      if (fki->flags & (int) FMT_FLAG_SCANF_A_KLUDGE)
        {
          if (*format_chars == 'a' && !flag_isoc99)
            {
@@ -2043,7 +2044,8 @@ check_format_info_main (status, res, info, format_chars, format_length,
 
       format_char = *format_chars;
       if (format_char == 0
-         || (!(fki->flags & FMT_FLAG_FANCY_PERCENT_OK) && format_char == '%'))
+         || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK)
+             && format_char == '%'))
        {
          status_warning (status, "conversion lacks type at end of format");
          continue;
@@ -2109,7 +2111,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
        flag_chars[i - d] = 0;
       }
 
-      if ((fki->flags & FMT_FLAG_SCANF_A_KLUDGE)
+      if ((fki->flags & (int) FMT_FLAG_SCANF_A_KLUDGE)
          && strchr (flag_chars, 'a') != 0)
        aflag = 1;
 
@@ -2190,7 +2192,7 @@ check_format_info_main (status, res, info, format_chars, format_length,
 
       wanted_type = 0;
       wanted_type_name = 0;
-      if (fki->flags & FMT_FLAG_ARG_CONVERT)
+      if (fki->flags & (int) FMT_FLAG_ARG_CONVERT)
        {
          wanted_type = (fci->types[length_chars_val].type
                         ? *fci->types[length_chars_val].type : 0);
index aa66d8e..51e0e70 100644 (file)
    operands[1] = gen_lowpart (SImode, operands[1]);
    if (GET_CODE (operands[3]) != ASHIFT)
      operands[2] = gen_lowpart (SImode, operands[2]);
-   GET_MODE (operands[3]) = SImode;")
+   PUT_MODE (operands[3], SImode);")
 
 (define_split
   [(set (reg 17)
index a7a9115..2d4e7c2 100644 (file)
@@ -4140,9 +4140,9 @@ init_emit_once (line_numbers)
        const_tiny_rtx[i][(int) mode] = GEN_INT (i);
     }
 
-  for (mode = CCmode; mode < MAX_MACHINE_MODE; ++mode)
-    if (GET_MODE_CLASS (mode) == MODE_CC)
-      const_tiny_rtx[0][(int) mode] = const0_rtx;
+  for (i = (int) CCmode; i < (int) MAX_MACHINE_MODE; ++i)
+    if (GET_MODE_CLASS ((enum machine_mode) i) == MODE_CC)
+      const_tiny_rtx[0][i] = const0_rtx;
 
   const_tiny_rtx[0][(int) BImode] = const0_rtx;
   if (STORE_FLAG_VALUE == 1)
index 2446d19..ff3f5bf 100644 (file)
@@ -2766,7 +2766,7 @@ emit_move_insn_1 (x, y)
   enum mode_class class = GET_MODE_CLASS (mode);
   unsigned int i;
 
-  if (mode >= MAX_MACHINE_MODE)
+  if ((unsigned int) mode >= (unsigned int) MAX_MACHINE_MODE)
     abort ();
 
   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
@@ -5766,7 +5766,8 @@ safe_from_p (x, exp, top_p)
 
       /* If this is a language-specific tree code, it may require
         special handling.  */
-      if (TREE_CODE (exp) >= LAST_AND_UNUSED_TREE_CODE
+      if ((unsigned int) TREE_CODE (exp)
+         >= (unsigned int) LAST_AND_UNUSED_TREE_CODE
          && lang_safe_from_p
          && !(*lang_safe_from_p) (x, exp))
        return 0;
index bd13425..88fffbd 100644 (file)
@@ -67,7 +67,7 @@ typedef enum {
 te_verbose  verbose_level = VERB_PROGRESS;
 int have_tty = 0;
 
-#define VLEVEL(l)  (verbose_level >= l)
+#define VLEVEL(l)  ((unsigned int) verbose_level >= (unsigned int) l)
 #define NOT_SILENT VLEVEL(VERB_FIXES)
 
 pid_t process_chain_head = (pid_t) -1;
index cbca47b..2856fe6 100644 (file)
@@ -1432,7 +1432,7 @@ merge_trees (oldh, addh)
             how expensive/important the test is.  Given that the tests
             are also ordered within the list, examining the first is
             sufficient.  */
-         if (add->tests->type < old->tests->type)
+         if ((int) add->tests->type < (int) old->tests->type)
            insert_before = old;
        }
 
index b421282..aeae71e 100644 (file)
@@ -373,8 +373,8 @@ print_rtx (in_rtx)
       /* Print NOTE_INSN names rather than integer codes.  */
 
       case 'n':
-       if (XINT (in_rtx, i) >= NOTE_INSN_BIAS
-           && XINT (in_rtx, i) < NOTE_INSN_MAX)
+       if (XINT (in_rtx, i) >= (int) NOTE_INSN_BIAS
+           && XINT (in_rtx, i) < (int) NOTE_INSN_MAX)
          fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i)));
        else
          fprintf (outfile, " %d", XINT (in_rtx, i));
index 7986a1e..f65b2e9 100644 (file)
@@ -430,7 +430,7 @@ init_reg_sets_1 ()
     }
   memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode));
   memset (allocatable_regs_of_mode, 0, sizeof (allocatable_regs_of_mode));
-  for (m = 0; m < MAX_MACHINE_MODE; m++)
+  for (m = 0; m < (unsigned int) MAX_MACHINE_MODE; m++)
     for (i = 0; i < N_REG_CLASSES; i++)
       if (CLASS_MAX_NREGS (i, m) <= reg_class_size[i])
        for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
@@ -445,7 +445,7 @@ init_reg_sets_1 ()
   /* Initialize the move cost table.  Find every subset of each class
      and take the maximum cost of moving any subset to any other.  */
 
-  for (m = 0; m < MAX_MACHINE_MODE; m++)
+  for (m = 0; m < (unsigned int) MAX_MACHINE_MODE; m++)
     if (allocatable_regs_of_mode [m])
       {
        for (i = 0; i < N_REG_CLASSES; i++)
@@ -631,6 +631,7 @@ choose_hard_reg_mode (regno, nregs)
      unsigned int regno ATTRIBUTE_UNUSED;
      unsigned int nregs;
 {
+  unsigned int /* enum machine_mode */ m;
   enum machine_mode found_mode = VOIDmode, mode;
 
   /* We first look for the largest integer mode that can be validly
@@ -658,10 +659,13 @@ choose_hard_reg_mode (regno, nregs)
     return found_mode;
 
   /* Iterate over all of the CCmodes.  */
-  for (mode = CCmode; mode < NUM_MACHINE_MODES; ++mode)
-    if (HARD_REGNO_NREGS (regno, mode) == nregs
-        && HARD_REGNO_MODE_OK (regno, mode))
-    return mode;
+  for (m = (unsigned int) CCmode; m < (unsigned int) NUM_MACHINE_MODES; ++m)
+    {
+      mode = (enum machine_mode) m;
+      if (HARD_REGNO_NREGS (regno, mode) == nregs
+         && HARD_REGNO_MODE_OK (regno, mode))
+       return mode;
+    }
 
   /* We can't find a mode valid for this register.  */
   return VOIDmode;
@@ -859,22 +863,23 @@ dump_regclass (dump)
   int i;
   for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
     {
-      enum reg_class class;
+      int /* enum reg_class */ class;
       if (REG_N_REFS (i))
        {
          fprintf (dump, "  Register %i costs:", i);
-         for (class = 0; class < N_REG_CLASSES; class++)
-           if (contains_reg_of_mode [class][PSEUDO_REGNO_MODE (i)]
+         for (class = 0; class < (int) N_REG_CLASSES; class++)
+           if (contains_reg_of_mode [(enum reg_class) class][PSEUDO_REGNO_MODE (i)]
 #ifdef FORBIDDEN_INC_DEC_CLASSES
-               && (!in_inc_dec[i] || !forbidden_inc_dec_class[class])
+               && (!in_inc_dec[i]
+                   || !forbidden_inc_dec_class[(enum reg_class) class])
 #endif
 #ifdef CLASS_CANNOT_CHANGE_MODE
                && (!REGNO_REG_SET_P (reg_changes_mode, i)
-                    || class_can_change_mode [class])
+                    || class_can_change_mode [(enum reg_class) class])
 #endif
                )
-           fprintf (dump, " %s:%i", reg_class_names[(int) class],
-                    costs[i].cost[class]);
+           fprintf (dump, " %s:%i", reg_class_names[class],
+                    costs[i].cost[(enum reg_class) class]);
          fprintf (dump, " MEM:%i\n", costs[i].mem_cost);
        }
     }
index 99c20ce..58f7428 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -184,11 +184,11 @@ typedef struct rtx_def
 
 /* Define macros to access the `code' field of the rtx.  */
 
-#define GET_CODE(RTX)          ((RTX)->code)
-#define PUT_CODE(RTX, CODE)    ((RTX)->code = (CODE))
+#define GET_CODE(RTX)      ((enum rtx_code) (RTX)->code)
+#define PUT_CODE(RTX, CODE) ((RTX)->code = (ENUM_BITFIELD(rtx_code)) (CODE))
 
-#define GET_MODE(RTX)          ((RTX)->mode)
-#define PUT_MODE(RTX, MODE)    ((RTX)->mode = (MODE))
+#define GET_MODE(RTX)      ((enum machine_mode) (RTX)->mode)
+#define PUT_MODE(RTX, MODE) ((RTX)->mode = (ENUM_BITFIELD(machine_mode)) (MODE))
 
 #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
 #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
@@ -702,7 +702,7 @@ enum insn_note
 
 extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
-  (note_insn_name[(NOTE_CODE) - NOTE_INSN_BIAS])
+  (note_insn_name[(NOTE_CODE) - (int) NOTE_INSN_BIAS])
 
 /* The name of a label, in case it corresponds to an explicit label
    in the input source code.  */
index cce106a..fd0f76c 100644 (file)
@@ -401,7 +401,7 @@ timevar_print (fp)
 {
   /* Only print stuff if we have some sort of time information.  */
 #if defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) || defined (HAVE_WALL_TIME)
-  timevar_id_t id;
+  unsigned int /* timevar_id_t */ id;
   struct timevar_time_def *total = &timevars[TV_TOTAL].elapsed;
   struct timevar_time_def now;
 
@@ -426,13 +426,13 @@ timevar_print (fp)
   start_time = now;
 
   fprintf (fp, _("\nExecution times (seconds)\n"));
-  for (id = 0; id < TIMEVAR_LAST; ++id)
+  for (id = 0; id < (unsigned int) TIMEVAR_LAST; ++id)
     {
-      struct timevar_def *tv = &timevars[id];
+      struct timevar_def *tv = &timevars[(timevar_id_t) id];
 
       /* Don't print the total execution time here; that goes at the
         end.  */
-      if (id == TV_TOTAL)
+      if ((timevar_id_t) id == TV_TOTAL)
        continue;
 
       /* Don't print timing variables that were never used.  */
index fdd8390..73f1b8f 100644 (file)
@@ -2500,7 +2500,7 @@ compile_file (name)
     {
       int i;
 
-      for (i = 0; i < DFI_MAX; ++i)
+      for (i = 0; i < (int) DFI_MAX; ++i)
        if (dump_file[i].initialized && dump_file[i].graph_dump_p)
          {
            char seq[16];
@@ -4021,7 +4021,7 @@ decode_d_option (arg)
     switch (c = *arg++)
       {
       case 'a':
-       for (i = 0; i < DFI_MAX; ++i)
+       for (i = 0; i < (int) DFI_MAX; ++i)
          dump_file[i].enabled = 1;
        break;
       case 'A':
@@ -4052,7 +4052,7 @@ decode_d_option (arg)
 
       default:
        matched = 0;
-       for (i = 0; i < DFI_MAX; ++i)
+       for (i = 0; i < (int) DFI_MAX; ++i)
          if (c == dump_file[i].debug_switch)
            {
              dump_file[i].enabled = 1;
index cfcd7be..d6dde70 100644 (file)
@@ -272,7 +272,8 @@ struct tree_common
 /* The tree-code says what kind of node it is.
    Codes are defined in tree.def.  */
 #define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
-#define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE))
+#define TREE_SET_CODE(NODE, VALUE) \
+((NODE)->common.code = (ENUM_BITFIELD(tree_code)) (VALUE))
 
 /* When checking is enabled, errors will be generated if a tree node
    is accessed incorrectly. The macros abort with a fatal error.  */
index 6e3b097..55c72d1 100644 (file)
@@ -2431,7 +2431,7 @@ const_hash (exp)
       
     default:
       /* A language specific constant. Just hash the code. */
-      return code % MAX_HASH_TABLE;
+      return (int) code % MAX_HASH_TABLE;
     }
 
   /* Compute hashing function */