Add casts for legitimate integer to enum conversions
authorSimon Marchi <simon.marchi@ericsson.com>
Thu, 6 Aug 2015 21:21:41 +0000 (17:21 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 6 Aug 2015 21:22:49 +0000 (17:22 -0400)
This patch is mostly extracted from Pedro's C++ branch.  It adds explicit
casts from integer to enum types, where it is really the intention to do
so.  This could be because we are ...

 * iterating on enum values (we need to iterate on an equivalent integer)
 * converting from a value read from bytes (dwarf attribute, agent
 expression opcode) to the equivalent enum
 * reading the equivalent integer value from another language (Python/Guile)

An exception to that is the casts in regcache.c.  It seems to me like
struct regcache's register_status field could be a pointer to an array of
enum register_status.  Doing so would waste a bit of memory (4 bytes
used by the enum vs 1 byte used by the current signed char, for each
register).  If we switch to C++11 one day, we can define the underlying
type of an enum type, so we could have the best of both worlds.

gdb/ChangeLog:

* arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum.
(arm_set_abi): Likewise.
* ax-general.c (ax_print): Likewise.
* c-exp.y (exp : string_exp): Likewise.
* compile/compile-loc2c.c (compute_stack_depth_worker): Likewise.
(do_compile_dwarf_expr_to_c): Likewise.
* cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start):
Likewise.
* dwarf2expr.c (execute_stack_op): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
(disassemble_dwarf_expression): Likewise.
* dwarf2read.c (dwarf2_add_member_fn): Likewise.
(read_array_order): Likewise.
(abbrev_table_read_table): Likewise.
(read_attribute_value): Likewise.
(skip_unknown_opcode): Likewise.
(dwarf_decode_macro_bytes): Likewise.
(dwarf_decode_macros): Likewise.
* eval.c (value_f90_subarray): Likewise.
* guile/scm-param.c (gdbscm_make_parameter): Likewise.
* i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
* infrun.c (handle_command): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
* osabi.c (set_osabi): Likewise.
* parse.c (operator_length_standard): Likewise.
* ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use
single return point.
* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
(gdbpy_lookup_global_symbol): Likewise.
* record-full.c (record_full_restore): Likewise.
* regcache.c (regcache_register_status): Likewise.
(regcache_raw_read): Likewise.
(regcache_cooked_read): Likewise.
* rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
* symtab.c (initialize_ordinary_address_classes): Likewise.
* target-debug.h (target_debug_print_signals): Likewise.
* utils.c (do_restore_current_language): Likewise.

25 files changed:
gdb/ChangeLog
gdb/arm-tdep.c
gdb/ax-general.c
gdb/c-exp.y
gdb/compile/compile-loc2c.c
gdb/cp-name-parser.y
gdb/dwarf2expr.c
gdb/dwarf2loc.c
gdb/dwarf2read.c
gdb/eval.c
gdb/guile/scm-param.c
gdb/i386-linux-tdep.c
gdb/infrun.c
gdb/memory-map.c
gdb/osabi.c
gdb/parse.c
gdb/ppc-linux-tdep.c
gdb/python/py-frame.c
gdb/python/py-symbol.c
gdb/record-full.c
gdb/regcache.c
gdb/rs6000-tdep.c
gdb/symtab.c
gdb/target-debug.h
gdb/utils.c

index ba497653ff4555d75910d2f331bd4263e0b0f9a8..8f76e86a6c5701f1d6c9963401191400e34931eb 100644 (file)
@@ -1,3 +1,45 @@
+2015-08-06  Simon Marchi  <simon.marchi@ericsson.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum.
+       (arm_set_abi): Likewise.
+       * ax-general.c (ax_print): Likewise.
+       * c-exp.y (exp : string_exp): Likewise.
+       * compile/compile-loc2c.c (compute_stack_depth_worker): Likewise.
+       (do_compile_dwarf_expr_to_c): Likewise.
+       * cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start):
+       Likewise.
+       * dwarf2expr.c (execute_stack_op): Likewise.
+       * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
+       (disassemble_dwarf_expression): Likewise.
+       * dwarf2read.c (dwarf2_add_member_fn): Likewise.
+       (read_array_order): Likewise.
+       (abbrev_table_read_table): Likewise.
+       (read_attribute_value): Likewise.
+       (skip_unknown_opcode): Likewise.
+       (dwarf_decode_macro_bytes): Likewise.
+       (dwarf_decode_macros): Likewise.
+       * eval.c (value_f90_subarray): Likewise.
+       * guile/scm-param.c (gdbscm_make_parameter): Likewise.
+       * i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
+       * infrun.c (handle_command): Likewise.
+       * memory-map.c (memory_map_start_memory): Likewise.
+       * osabi.c (set_osabi): Likewise.
+       * parse.c (operator_length_standard): Likewise.
+       * ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use
+       single return point.
+       * python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.
+       * python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
+       (gdbpy_lookup_global_symbol): Likewise.
+       * record-full.c (record_full_restore): Likewise.
+       * regcache.c (regcache_register_status): Likewise.
+       (regcache_raw_read): Likewise.
+       (regcache_cooked_read): Likewise.
+       * rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
+       * symtab.c (initialize_ordinary_address_classes): Likewise.
+       * target-debug.h (target_debug_print_signals): Likewise.
+       * utils.c (do_restore_current_language): Likewise.
+
 2015-08-06  Clem Dickey  <clemd@acm.org>
 
        PR python/17136
index a458c9a1d5dfaaabf80cfb68dafc6d38da9f2524..73f26b93da9d5fc1e095f88b03d75005e714b465 100644 (file)
@@ -9408,7 +9408,7 @@ set_fp_model_sfunc (char *args, int from_tty,
   for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
     if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
       {
-       arm_fp_model = fp_model;
+       arm_fp_model = (enum arm_float_model) fp_model;
        break;
       }
 
@@ -9445,7 +9445,7 @@ arm_set_abi (char *args, int from_tty,
   for (arm_abi = ARM_ABI_AUTO; arm_abi != ARM_ABI_LAST; arm_abi++)
     if (strcmp (arm_abi_string, arm_abi_strings[arm_abi]) == 0)
       {
-       arm_abi_global = arm_abi;
+       arm_abi_global = (enum arm_abi_kind) arm_abi;
        break;
       }
 
index 3e31144b64fe72190af22e67d65d617c0f1889ae..485b2ad10307469c1c454b9298c2402f30713318 100644 (file)
@@ -391,7 +391,7 @@ ax_print (struct ui_file *f, struct agent_expr *x)
 
   for (i = 0; i < x->len;)
     {
-      enum agent_op op = x->buf[i];
+      enum agent_op op = (enum agent_op) x->buf[i];
 
       if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
          || !aop_map[op].name)
index 59cecb5f3fffedb5c1dfe93b765a14794c5c5840..a8a4caf1125e8260db3156024bb30496bdaebb2f 100644 (file)
@@ -878,7 +878,7 @@ exp :       string_exp
                                  if (type != C_STRING
                                      && type != $1.tokens[i].type)
                                    error (_("Undefined string concatenation."));
-                                 type = $1.tokens[i].type;
+                                 type = (enum c_string_type) $1.tokens[i].type;
                                  break;
                                default:
                                  /* internal error */
index 6f538142891619168600378b197ff245831eef27..b201d136314bb9979befca0c371087ef103c9d4c 100644 (file)
@@ -85,7 +85,7 @@ compute_stack_depth_worker (int start, int *need_tempvar,
 
   while (op_ptr < op_end)
     {
-      enum dwarf_location_atom op = *op_ptr;
+      enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
       uint64_t reg;
       int64_t offset;
       int ndx = op_ptr - base;
@@ -667,7 +667,7 @@ do_compile_dwarf_expr_to_c (int indent, struct ui_file *stream,
 
   while (op_ptr < op_end)
     {
-      enum dwarf_location_atom op = *op_ptr;
+      enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
       uint64_t uoffset, reg;
       int64_t offset;
 
index b4690ea497bc90b8f03940abe0f1b481feaf42b1..0657a527a8e879aed98ab8dbd3d4c1cfdca1a37d 100644 (file)
@@ -432,7 +432,7 @@ function
 
 demangler_special
                :       DEMANGLER_SPECIAL start
-                       { $$ = make_empty ($1);
+                       { $$ = make_empty ((enum demangle_component_type) $1);
                          d_left ($$) = $2;
                          d_right ($$) = NULL; }
                |       CONSTRUCTION_VTABLE start CONSTRUCTION_IN start
index 071b83fa7042a4bd5ac7c4cd14af4a7b2ab10c65..862a75387fe2a347f5648b5248bc384ca40fd597 100644 (file)
@@ -654,7 +654,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
 
   while (op_ptr < op_end)
     {
-      enum dwarf_location_atom op = *op_ptr++;
+      enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr++;
       ULONGEST result;
       /* Assume the value is not in stack memory.
         Code that knows otherwise sets this to 1.
index c75767ee09cb20edc6925f139294f702ae73de69..d8e432ed930469f56e605f3c8f0a05111400da97 100644 (file)
@@ -2881,7 +2881,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 
   while (op_ptr < op_end)
     {
-      enum dwarf_location_atom op = *op_ptr;
+      enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
       uint64_t uoffset, reg;
       int64_t offset;
       int i;
@@ -3764,7 +3764,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
         && (all
             || (data[0] != DW_OP_piece && data[0] != DW_OP_bit_piece)))
     {
-      enum dwarf_location_atom op = *data++;
+      enum dwarf_location_atom op = (enum dwarf_location_atom) *data++;
       uint64_t ul;
       int64_t l;
       const char *name;
index b5ffd04e08d0c19d09889d78794efca0dc04b8d0..7e7934276bdaff405a983eaf01bd19741198f1b8 100644 (file)
@@ -12897,7 +12897,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
   /* Get accessibility.  */
   attr = dwarf2_attr (die, DW_AT_accessibility, cu);
   if (attr)
-    accessibility = DW_UNSND (attr);
+    accessibility = (enum dwarf_access_attribute) DW_UNSND (attr);
   else
     accessibility = dwarf2_default_access_attribute (die, cu);
   switch (accessibility)
@@ -13812,7 +13812,8 @@ read_array_order (struct die_info *die, struct dwarf2_cu *cu)
 
   attr = dwarf2_attr (die, DW_AT_ordering, cu);
 
-  if (attr) return DW_SND (attr);
+  if (attr)
+    return (enum dwarf_array_dim_ordering) DW_SND (attr);
 
   /* GNU F77 is a special case, as at 08/2004 array type info is the
      opposite order to the dwarf2 specification, but data is still
@@ -15345,7 +15346,8 @@ abbrev_table_read_table (struct dwarf2_section_info *section,
 
       /* read in abbrev header */
       cur_abbrev->number = abbrev_number;
-      cur_abbrev->tag = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
+      cur_abbrev->tag
+       = (enum dwarf_tag) read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
       abbrev_ptr += bytes_read;
       cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr);
       abbrev_ptr += 1;
@@ -15365,8 +15367,10 @@ abbrev_table_read_table (struct dwarf2_section_info *section,
                                        * sizeof (struct attr_abbrev)));
            }
 
-         cur_attrs[cur_abbrev->num_attrs].name = abbrev_name;
-         cur_attrs[cur_abbrev->num_attrs++].form = abbrev_form;
+         cur_attrs[cur_abbrev->num_attrs].name
+           = (enum dwarf_attribute) abbrev_name;
+         cur_attrs[cur_abbrev->num_attrs++].form
+           = (enum dwarf_form) abbrev_form;
          abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
          abbrev_ptr += bytes_read;
          abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -16210,7 +16214,7 @@ read_attribute_value (const struct die_reader_specs *reader,
   unsigned int bytes_read;
   struct dwarf_block *blk;
 
-  attr->form = form;
+  attr->form = (enum dwarf_form) form;
   switch (form)
     {
     case DW_FORM_ref_addr:
@@ -21170,7 +21174,8 @@ skip_unknown_opcode (unsigned int opcode,
 
   for (i = 0; i < arg; ++i)
     {
-      mac_ptr = skip_form_bytes (abfd, mac_ptr, mac_end, defn[i], offset_size,
+      mac_ptr = skip_form_bytes (abfd, mac_ptr, mac_end,
+                                (enum dwarf_form) defn[i], offset_size,
                                 section);
       if (mac_ptr == NULL)
        {
@@ -21287,7 +21292,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
          break;
        }
 
-      macinfo_type = read_1_byte (abfd, mac_ptr);
+      macinfo_type = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
       mac_ptr++;
 
       /* Note that we rely on the fact that the corresponding GNU and
@@ -21427,7 +21432,9 @@ dwarf_decode_macro_bytes (bfd *abfd,
 
                   /* We don't increment mac_ptr here, so this is just
                      a look-ahead.  */
-                  next_type = read_1_byte (abfd, mac_ptr);
+                  next_type
+                   = (enum dwarf_macro_record_type) read_1_byte (abfd,
+                                                                 mac_ptr);
                   if (next_type != 0)
                    complaint (&symfile_complaints,
                               _("no terminating 0-type entry for "
@@ -21603,7 +21610,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
          break;
         }
 
-      macinfo_type = read_1_byte (abfd, mac_ptr);
+      macinfo_type = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
       mac_ptr++;
 
       /* Note that we rely on the fact that the corresponding GNU and
index 7ccc8836aba10a5373071acaee74ba30e627e883..2beea10dbb2324f3a266064a2f1f7a7b82b7a667 100644 (file)
@@ -406,7 +406,8 @@ value_f90_subarray (struct value *array,
   int pc = (*pos) + 1;
   LONGEST low_bound, high_bound;
   struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
-  enum f90_range_type range_type = longest_to_int (exp->elts[pc].longconst);
+  enum f90_range_type range_type
+    = (enum f90_range_type) longest_to_int (exp->elts[pc].longconst);
  
   *pos += 3;
 
index da9c31a41b6e1a43d48a66575b73b27a4a031116..9737c25e03b435374b80ea667a9d6229d6843db0 100644 (file)
@@ -939,7 +939,7 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
   /* These are all stored in GC space so that we don't have to worry about
      freeing them if we throw an exception.  */
   p_smob->name = name;
-  p_smob->cmd_class = cmd_class;
+  p_smob->cmd_class = (enum command_class) cmd_class;
   p_smob->type = (enum var_types) param_type;
   p_smob->doc = doc;
   p_smob->set_doc = set_doc;
index 04ce2df530131e6326b9f052a2b5cba25dc96bf3..898beda118c33308842fecdd84e4faf76ed82041 100644 (file)
@@ -379,7 +379,7 @@ i386_canonicalize_syscall (int syscall)
   enum { i386_syscall_max = 499 };
 
   if (syscall <= i386_syscall_max)
-    return syscall;
+    return (enum gdb_syscall) syscall;
   else
     return gdb_sys_no_syscall;
 }
index a2e7cfc343cf8c8b2ac62e717cf69c8d276a077b..c717ae5c1105faa5eeba2ea5173d306a694b912c 100644 (file)
@@ -7054,7 +7054,7 @@ Are you sure you want to change it? "),
            sig_print_header ();
            for (; signum < nsigs; signum++)
              if (sigs[signum])
-               sig_print_info (signum);
+               sig_print_info ((enum gdb_signal) signum);
          }
 
        break;
index fa713c9620024cae052d475f0b0804422eb762ff..77eb93e781b5e834e97571e650d8414ee485de59 100644 (file)
@@ -66,7 +66,7 @@ memory_map_start_memory (struct gdb_xml_parser *parser,
   mem_region_init (r);
   r->lo = *start_p;
   r->hi = r->lo + *length_p;
-  r->attrib.mode = *type_p;
+  r->attrib.mode = (enum mem_access_mode) *type_p;
   r->attrib.blocksize = -1;
 }
 
index 3581eb334c4efcc1e5747a76de09de26c4c03d83..2c75567f9c2218919d984e8bee6e0e441f45ddf2 100644 (file)
@@ -626,12 +626,16 @@ set_osabi (char *args, int from_tty, struct cmd_list_element *c)
       int i;
 
       for (i = 1; i < GDB_OSABI_INVALID; i++)
-       if (strcmp (set_osabi_string, gdbarch_osabi_name (i)) == 0)
-         {
-           user_selected_osabi = i;
-           user_osabi_state = osabi_user;
-           break;
-         }
+        {
+         enum gdb_osabi osabi = (enum gdb_osabi) i;
+
+         if (strcmp (set_osabi_string, gdbarch_osabi_name (osabi)) == 0)
+           {
+             user_selected_osabi = osabi;
+             user_osabi_state = osabi_user;
+             break;
+           }
+       }
       if (i == GDB_OSABI_INVALID)
        internal_error (__FILE__, __LINE__,
                        _("Invalid OS ABI \"%s\" passed to command handler."),
index 75b7cfac1f235914b78f9f30da30a4273830ddae..373b0b305241abcf1a769597ab8a3ad56c535d0e 100644 (file)
@@ -1005,8 +1005,9 @@ operator_length_standard (const struct expression *expr, int endpos,
 
     case OP_F90_RANGE:
       oplen = 3;
+      range_type = (enum f90_range_type)
+       longest_to_int (expr->elts[endpos - 2].longconst);
 
-      range_type = longest_to_int (expr->elts[endpos - 2].longconst);
       switch (range_type)
        {
        case LOW_BOUND_DEFAULT:
index cf46c2d99d70683ebf544fd661b8d8d181190d34..69c791e39ffe799257ab2ae4153286f474515d36 100644 (file)
@@ -765,29 +765,32 @@ static struct linux_record_tdep ppc64_linux_record_tdep;
 static enum gdb_syscall
 ppc_canonicalize_syscall (int syscall)
 {
+  int result = -1;
+
   if (syscall <= 165)
-    return syscall;
+    result = syscall;
   else if (syscall >= 167 && syscall <= 190)   /* Skip query_module 166 */
-    return syscall + 1;
+    result = syscall + 1;
   else if (syscall >= 192 && syscall <= 197)   /* mmap2 */
-    return syscall;
+    result = syscall;
   else if (syscall == 208)                     /* tkill */
-    return gdb_sys_tkill;
+    result = gdb_sys_tkill;
   else if (syscall >= 207 && syscall <= 220)   /* gettid */
-    return syscall + 224 - 207;
+    result = syscall + 224 - 207;
   else if (syscall >= 234 && syscall <= 239)   /* exit_group */
-    return syscall + 252 - 234;
-  else if (syscall >= 240 && syscall <=248)    /* timer_create */
-    return syscall += 259 - 240;
-  else if (syscall >= 250 && syscall <=251)    /* tgkill */
-    return syscall + 270 - 250;
+    result = syscall + 252 - 234;
+  else if (syscall >= 240 && syscall <= 248)   /* timer_create */
+    result = syscall += 259 - 240;
+  else if (syscall >= 250 && syscall <= 251)   /* tgkill */
+    result = syscall + 270 - 250;
   else if (syscall == 336)
-    return gdb_sys_recv;
+    result = gdb_sys_recv;
   else if (syscall == 337)
-    return gdb_sys_recvfrom;
+    result = gdb_sys_recvfrom;
   else if (syscall == 342)
-    return gdb_sys_recvmsg;
-  return -1;
+    result = gdb_sys_recvmsg;
+
+  return (enum gdb_syscall) result;
 }
 
 /* Record registers which might be clobbered during system call.
index 72900561ca4757e4d9fa5807926b3090a089a92e..7e5dd17b339dcdbe74b5ce4616e56414c23012e0 100644 (file)
@@ -666,7 +666,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  str = unwind_stop_reason_to_string (reason);
+  str = unwind_stop_reason_to_string ((enum unwind_stop_reason) reason);
   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
 }
 
index 401e7e98bc5c68beaa23e55926ce56d36dd4e256..f6466bd1c154175ca594d28c5a56357b3c911fd8 100644 (file)
@@ -396,7 +396,8 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   TRY
     {
-      symbol = lookup_symbol (name, block, domain, &is_a_field_of_this).symbol;
+      symbol = lookup_symbol (name, block, (domain_enum) domain,
+                             &is_a_field_of_this).symbol;
     }
   CATCH (except, RETURN_MASK_ALL)
     {
@@ -449,7 +450,7 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   TRY
     {
-      symbol = lookup_global_symbol (name, NULL, domain).symbol;
+      symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
     }
   CATCH (except, RETURN_MASK_ALL)
     {
index 1520811053d57ea66cdadc5c8146e7f83abc1679..8c1ca752dba6c70fabd778a8a4e231296bd5db00 100644 (file)
@@ -2421,7 +2421,7 @@ record_full_restore (void)
          bfdcore_read (core_bfd, osec, &signal, 
                        sizeof (signal), &bfd_offset);
          signal = netorder32 (signal);
-         rec->u.end.sigval = signal;
+         rec->u.end.sigval = (enum gdb_signal) signal;
 
          /* Get insn count.  */
          bfdcore_read (core_bfd, osec, &count, 
index 86e648ae3d9b52496218f0cce97cee547321741a..d440dd44a12c34a0bd3e65e8a7cfd0b647d84155 100644 (file)
@@ -452,7 +452,7 @@ regcache_register_status (const struct regcache *regcache, int regnum)
   else
     gdb_assert (regnum < regcache->descr->nr_raw_registers);
 
-  return regcache->register_status[regnum];
+  return (enum register_status) regcache->register_status[regnum];
 }
 
 void
@@ -664,7 +664,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
     memcpy (buf, register_buffer (regcache, regnum),
            regcache->descr->sizeof_register[regnum]);
 
-  return regcache->register_status[regnum];
+  return (enum register_status) regcache->register_status[regnum];
 }
 
 enum register_status
@@ -751,7 +751,7 @@ regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
       else
        memset (buf, 0, regcache->descr->sizeof_register[regnum]);
 
-      return regcache->register_status[regnum];
+      return (enum register_status) regcache->register_status[regnum];
     }
   else if (gdbarch_pseudo_register_read_value_p (regcache->descr->gdbarch))
     {
index eb40430bee3074242b127bfa2a4100f4d2059527..5176fa056c97540c441e62fc946e4d8975aafc66 100644 (file)
@@ -6060,7 +6060,7 @@ powerpc_set_vector_abi (char *args, int from_tty,
     if (strcmp (powerpc_vector_abi_string,
                powerpc_vector_strings[vector_abi]) == 0)
       {
-       powerpc_vector_abi_global = vector_abi;
+       powerpc_vector_abi_global = (enum powerpc_vector_abi) vector_abi;
        break;
       }
 
index 8aeabe86b84995b8ce6dcc2b8fd9c9b6def15ece..ebafe532e10c76a89fb7752ec9e10d0b319dc859 100644 (file)
@@ -6151,7 +6151,7 @@ initialize_ordinary_address_classes (void)
   int i;
 
   for (i = 0; i < LOC_FINAL_VALUE; ++i)
-    symbol_impl[i].aclass = i;
+    symbol_impl[i].aclass = (enum address_class) i;
 }
 
 \f
index e1ffc5b929daf918d87f9e1c072c0065d085ed8e..ddbdfd16597b38152265f4118ed05991c6c99a38 100644 (file)
@@ -192,7 +192,10 @@ target_debug_print_signals (unsigned char *sigs)
 
       for (i = 0; i < GDB_SIGNAL_LAST; i++)
        if (sigs[i])
-         fprintf_unfiltered (gdb_stdlog, " %s", gdb_signal_to_name (i));
+         {
+           fprintf_unfiltered (gdb_stdlog, " %s",
+                               gdb_signal_to_name ((enum gdb_signal) i));
+         }
     }
   fputs_unfiltered (" }", gdb_stdlog);
 }
index acb4c7d52955f62670adbcede7f2784a1aabd447..e5ad19586eac5f5e01bd4db64b4d0700a4aef439 100644 (file)
@@ -429,7 +429,7 @@ make_cleanup_free_so (struct so_list *so)
 static void
 do_restore_current_language (void *p)
 {
-  enum language saved_lang = (uintptr_t) p;
+  enum language saved_lang = (enum language) (uintptr_t) p;
 
   set_language (saved_lang);
 }
This page took 0.05441 seconds and 4 git commands to generate.