diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2015-08-06 17:21:41 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2015-08-06 17:22:49 -0400 |
commit | aead7601eb0ddc3fa51d43747bdad0e02abda342 (patch) | |
tree | e5c4d43a1986795822cf6a6be84a1923eb0cf10d /gdb | |
parent | 84da3f0cf938f8f74d9fa89f89f228bc950282c6 (diff) | |
download | gdb-aead7601eb0ddc3fa51d43747bdad0e02abda342.zip gdb-aead7601eb0ddc3fa51d43747bdad0e02abda342.tar.gz gdb-aead7601eb0ddc3fa51d43747bdad0e02abda342.tar.bz2 |
Add casts for legitimate integer to enum conversions
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 42 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 4 | ||||
-rw-r--r-- | gdb/ax-general.c | 2 | ||||
-rw-r--r-- | gdb/c-exp.y | 2 | ||||
-rw-r--r-- | gdb/compile/compile-loc2c.c | 4 | ||||
-rw-r--r-- | gdb/cp-name-parser.y | 2 | ||||
-rw-r--r-- | gdb/dwarf2expr.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 27 | ||||
-rw-r--r-- | gdb/eval.c | 3 | ||||
-rw-r--r-- | gdb/guile/scm-param.c | 2 | ||||
-rw-r--r-- | gdb/i386-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 2 | ||||
-rw-r--r-- | gdb/memory-map.c | 2 | ||||
-rw-r--r-- | gdb/osabi.c | 16 | ||||
-rw-r--r-- | gdb/parse.c | 3 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 31 | ||||
-rw-r--r-- | gdb/python/py-frame.c | 2 | ||||
-rw-r--r-- | gdb/python/py-symbol.c | 5 | ||||
-rw-r--r-- | gdb/record-full.c | 2 | ||||
-rw-r--r-- | gdb/regcache.c | 6 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 2 | ||||
-rw-r--r-- | gdb/symtab.c | 2 | ||||
-rw-r--r-- | gdb/target-debug.h | 5 | ||||
-rw-r--r-- | gdb/utils.c | 2 |
25 files changed, 119 insertions, 57 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba49765..8f76e86 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index a458c9a..73f26b9 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -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; } diff --git a/gdb/ax-general.c b/gdb/ax-general.c index 3e31144..485b2ad 100644 --- a/gdb/ax-general.c +++ b/gdb/ax-general.c @@ -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) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 59cecb5..a8a4caf 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -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 */ diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 6f53814..b201d13 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -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; diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index b4690ea..0657a52 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -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 diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 071b83f..862a753 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -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. diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index c75767e..d8e432e 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -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; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b5ffd04..7e79342 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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 @@ -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; diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index da9c31a..9737c25 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -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; diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 04ce2df..898beda 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -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; } diff --git a/gdb/infrun.c b/gdb/infrun.c index a2e7cfc..c717ae5 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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; diff --git a/gdb/memory-map.c b/gdb/memory-map.c index fa713c9..77eb93e 100644 --- a/gdb/memory-map.c +++ b/gdb/memory-map.c @@ -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; } diff --git a/gdb/osabi.c b/gdb/osabi.c index 3581eb3..2c75567 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -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."), diff --git a/gdb/parse.c b/gdb/parse.c index 75b7cfa..373b0b3 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -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: diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index cf46c2d..69c791e 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -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. diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 7290056..7e5dd17 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -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); } diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 401e7e9..f6466bd 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -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) { diff --git a/gdb/record-full.c b/gdb/record-full.c index 1520811..8c1ca75 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -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, diff --git a/gdb/regcache.c b/gdb/regcache.c index 86e648a..d440dd4 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -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)) { diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index eb40430..5176fa0 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -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; } diff --git a/gdb/symtab.c b/gdb/symtab.c index 8aeabe86..ebafe53 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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; } diff --git a/gdb/target-debug.h b/gdb/target-debug.h index e1ffc5b..ddbdfd1 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -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); } diff --git a/gdb/utils.c b/gdb/utils.c index acb4c7d..e5ad195 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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); } |