This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[COMMITTED PATCH] cast enum values to type of initializer in cr{16,x}-opc.c
- From: Roland McGrath <mcgrathr at google dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 10 Oct 2013 10:44:20 -0700
- Subject: [COMMITTED PATCH] cast enum values to type of initializer in cr{16,x}-opc.c
- Authentication-results: sourceware.org; auth=none
Committed as obvious enough, to trunk and 2.24 branch.
Thanks,
Roland
opcodes/
* cr16-opc.c (REG): Cast NAME to 'reg' enum type to suppress
possible compiler warnings when the union's initializer is
actually meant for the 'preg' enum typed member.
* crx-opc.c (REG): Likewise.
--- a/opcodes/cr16-opc.c
+++ b/opcodes/cr16-opc.c
@@ -1,5 +1,5 @@
/* cr16-opc.c -- Table of opcodes for the CR16 processor.
- Copyright 2007, 2008, 2010 Free Software Foundation, Inc.
+ Copyright 2007, 2008, 2010, 2013 Free Software Foundation, Inc.
Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com)
This file is part of the GNU opcodes library.
@@ -459,8 +459,11 @@ const unsigned int cr16_num_opcodes = ARRAY_SIZE
(cr16_instruction);
For example :
REG(u4, 0x84, CR16_U_REGTYPE)
is interpreted as :
- {"u4", u4, 0x84, CR16_U_REGTYPE} */
-#define REG(NAME, N, TYPE) {STRINGX(NAME), {NAME}, N, TYPE}
+ {"u4", u4, 0x84, CR16_U_REGTYPE}
+ The union initializer (second member) always refers to the first
+ member of the union, so cast NAME to that type to avoid possible
+ compiler warnings when used for CR16_P_REGTYPE cases. */
+#define REG(NAME, N, TYPE) {STRINGX(NAME), {(reg) NAME}, N, TYPE}
#define REGP(NAME, BNAME, N, TYPE) {STRINGX(NAME), {BNAME}, N, TYPE}
--- a/opcodes/crx-opc.c
+++ b/opcodes/crx-opc.c
@@ -1,5 +1,5 @@
/* crx-opc.c -- Table of opcodes for the CRX processor.
- Copyright 2004, 2005, 2007, 2012 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2007, 2012, 2013 Free Software Foundation, Inc.
Contributed by Tomer Levi NSC, Israel.
Originally written for GAS 2.12 by Tomer Levi.
@@ -587,8 +587,11 @@ const int crx_num_opcodes = ARRAY_SIZE (crx_instruction);
For example :
REG(u4, 0x84, CRX_U_REGTYPE)
is interpreted as :
- {"u4", u4, 0x84, CRX_U_REGTYPE} */
-#define REG(NAME, N, TYPE) {STRINGX(NAME), {NAME}, N, TYPE}
+ {"u4", u4, 0x84, CRX_U_REGTYPE}
+ The union initializer (second member) always refers to the first
+ member of the union, so cast NAME to that type to avoid possible
+ compiler warnings when used for non-CRX_R_REGTYPE cases. */
+#define REG(NAME, N, TYPE) {STRINGX(NAME), {(reg) NAME}, N, TYPE}
const reg_entry crx_regtab[] =
{