This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] use enum values instead of integer constants


From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

Hi,

Its easier to understand what's going on if the value is a member of the
variables type.  Some of these cases are just in sentinal array elements and it
doesn't matter much, but it doesn't really hurt anything, and it makes it
easier to find the cases where it does matter.  The case in tc-i386.c may
actually be making a bug more visible but it isn't obvious if that particular
error can happen here or if it actually manages to work out.

built and regtested crosses to aarch64-linux-elf bfin-linux-elf i386-linux-elf
visium-elf xtensa-linux-elf and mcore-elf, ok?

Trev

gas/ChangeLog:

2016-04-21  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-aarch64.c: Use enum value instead of integer constant.
	* config/tc-bfin.c (struct bfin_cpu): Likewise.
	* config/tc-i386.c (match_template): Likewise.
	* config/tc-visium.c: Likewise.
	* config/tc-xtensa.c (xg_assemble_literal_space): Likewise.

opcodes/ChangeLog:

2016-04-21  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* mcore-opc.h: Use enum value instead of integer constant.
---
 gas/config/tc-aarch64.c | 2 +-
 gas/config/tc-bfin.c    | 2 +-
 gas/config/tc-i386.c    | 2 +-
 gas/config/tc-visium.c  | 2 +-
 gas/config/tc-xtensa.c  | 2 +-
 opcodes/mcore-opc.h     | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 9f8764e..c815ed5 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -7987,7 +7987,7 @@ struct aarch64_option_abi_value_table
 static const struct aarch64_option_abi_value_table aarch64_abis[] = {
   {"ilp32",		AARCH64_ABI_ILP32},
   {"lp64",		AARCH64_ABI_LP64},
-  {NULL,		0}
+  {NULL,	AARCH64_ABI_LP64	}
 };
 
 static int
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index 8cf2d5b..f5dfcc1 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -325,7 +325,7 @@ struct bfin_cpu bfin_cpus[] =
   {"bf592", BFIN_CPU_BF592, 0x0001, AC_05000074},
   {"bf592", BFIN_CPU_BF592, 0x0000, AC_05000074},
 
-  {NULL, 0, 0, 0}
+  {NULL, BFIN_CPU_UNKNOWN, 0, 0}
 };
 
 /* Define bfin-specific command-line options (there are none). */
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index f382a73..511d082 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4657,7 +4657,7 @@ match_template (void)
   unsigned int j;
   unsigned int found_cpu_match;
   unsigned int check_register;
-  enum i386_error specific_error = 0;
+  enum i386_error specific_error = operand_size_mismatch;
 
 #if MAX_OPERANDS != 5
 # error "MAX_OPERANDS must be 5."
diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c
index c618524..08f7c45 100644
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -275,7 +275,7 @@ static struct visium_arch_option_table visium_archs[] =
   {"mcm",   VISIUM_ARCH_MCM},
   {"gr5",   VISIUM_ARCH_MCM},
   {"gr6",   VISIUM_ARCH_GR6},
-  {NULL, 0}
+  {NULL, VISIUM_ARCH_DEF}
 };
 
 struct visium_long_option_table
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index b7d1582..6e5c776 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -4264,7 +4264,7 @@ xg_assemble_literal_space (/* const */ int size, int slot)
   lit_saved_frag = frag_now;
   frag_now->tc_frag_data.literal_frag = get_literal_pool_location (now_seg);
   frag_now->fr_symbol = xtensa_create_literal_symbol (now_seg, frag_now);
-  xg_finish_frag (0, RELAX_LITERAL, 0, size, FALSE);
+  xg_finish_frag (0, RELAX_LITERAL, RELAX_XTENSA_NONE, size, FALSE);
 
   /* Go back.  */
   xtensa_restore_emit_state (&state);
diff --git a/opcodes/mcore-opc.h b/opcodes/mcore-opc.h
index 24c3f88..70ed6ad 100644
--- a/opcodes/mcore-opc.h
+++ b/opcodes/mcore-opc.h
@@ -206,6 +206,6 @@ const mcore_opcode_info mcore_table[] =
   { "rori",	RSI,	0,	0x3800 },
   { "rotri",	RSI,    0,	0x3800 },
   { "nop",	O0,     0,	0x1200 },  /* mov r0, r0 */
-  { 0,		0,	0,      0 }
+  { 0,		O0,	0,      0 }
 };
 #endif
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]