old-cross-binutils/gdb/python
Simon Marchi aead7601eb 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.
2015-08-06 17:22:49 -04:00
..
lib/gdb PR python/17136 2015-08-06 09:24:58 -07:00
py-arch.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-auto-load.c
py-block.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-bpevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-breakpoint.c more making TRY/CATCH callers look more like real C++ try/catch blocks 2015-03-07 15:19:57 +00:00
py-cmd.c Remove --xdb 2015-04-11 19:49:03 +02:00
py-continueevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-event.c
py-event.h Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-events.h
py-evtregistry.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-evts.c
py-exitedevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-finishbreakpoint.c infcall: stop_registers -> register_dummy_frame_dtor 2015-05-13 20:49:08 +02:00
py-frame.c Add casts for legitimate integer to enum conversions 2015-08-06 17:22:49 -04:00
py-framefilter.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-function.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-gdb-readline.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-inferior.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-infevents.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-infthread.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-lazy-string.c PR python/18438 2015-05-26 16:13:04 -07:00
py-linetable.c python: fix Linetable case to LineTable in docstrings and comments 2015-08-04 09:50:53 -07:00
py-newobjfileevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-objfile.c Allow gdb to find debug symbols file by build-id for PE file format also 2015-06-15 12:10:55 +01:00
py-param.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-prettyprint.c PR python/18089 2015-04-28 21:53:54 -07:00
py-progspace.c Add support for writing unwinders in Python. 2015-04-01 11:49:12 -07:00
py-signalevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-stopevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-stopevent.h
py-symbol.c Add casts for legitimate integer to enum conversions 2015-08-06 17:22:49 -04:00
py-symtab.c python: fix Linetable case to LineTable in docstrings and comments 2015-08-04 09:50:53 -07:00
py-threadevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-type.c Remove CHECK_TYPEDEF, use check_typedef instead 2015-07-14 16:42:16 -04:00
py-unwind.c Fix a couple C++ build issues 2015-05-15 16:00:40 +01:00
py-utils.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-value.c Remove CHECK_TYPEDEF, use check_typedef instead 2015-07-14 16:42:16 -04:00
py-varobj.c
py-xmethods.c PR python/18285 2015-04-29 13:24:21 -07:00
python-config.py
python-internal.h Remove redundant include directives. 2015-06-24 13:52:29 +01:00
python.c PR python/18285 2015-04-29 13:24:21 -07:00
python.h