On Tue, Jul 18, 2017 at 03:09:56AM -0300, Philippe Mathieu-Daudé wrote: > Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
ppc parts, Acked-by: David Gibson <da...@gibson.dropbear.id.au> Although.. I note that this disas stuff is pulled in from binutils / gas. Are local changes going to make it harder to update from there again? > --- > disas/ia64.c | 4 ++-- > disas/m68k.c | 5 ++--- > disas/ppc.c | 12 ++++-------- > disas/s390.c | 3 +-- > 4 files changed, 9 insertions(+), 15 deletions(-) > > diff --git a/disas/ia64.c b/disas/ia64.c > index 140754c944..a668a49f69 100644 > --- a/disas/ia64.c > +++ b/disas/ia64.c > @@ -385,7 +385,7 @@ struct ia64_operand > /* Disassemble as unsigned decimal (instead of hex): */ > #define IA64_OPND_FLAG_DECIMAL_UNSIGNED (1<<1) > > -#define NELEMS(a) ((int) (sizeof (a) / sizeof (a[0]))) > +#define NELEMS(a) ((int) ARRAY_SIZE(a)) > > static const char* > ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED, > @@ -2857,7 +2857,7 @@ static const unsigned short dep257[] = { > 2170, 2173, 2274, 2284, 2327, 4135, 20616, 28866, 29018, > }; > > -#define NELS(X) (sizeof(X)/sizeof(X[0])) > +#define NELS(X) ARRAY_SIZE(X) > static const struct ia64_opcode_dependency > op_dependencies[] = { > { NELS(dep1), dep1, NELS(dep0), dep0, }, > diff --git a/disas/m68k.c b/disas/m68k.c > index 61b689ef3e..9989989e02 100644 > --- a/disas/m68k.c > +++ b/disas/m68k.c > @@ -4197,7 +4197,7 @@ TBL("tblunb", "tblunw", "tblunl", 0, 0), > {"wdebug", 4, two(0175750, 03), two(0177770, 0xffff), "ds", > mcfisa_a }, > }; > > -const int m68k_numopcodes = sizeof m68k_opcodes / sizeof m68k_opcodes[0]; > +const int m68k_numopcodes = ARRAY_SIZE(m68k_opcodes); > > /* These aliases used to be in the above table, each one duplicating > all of the entries for its primary exactly. This table was > @@ -4450,8 +4450,7 @@ const struct m68k_opcode_alias m68k_opcode_aliases[] = > > }; > > -const int m68k_numaliases = > - sizeof m68k_opcode_aliases / sizeof m68k_opcode_aliases[0]; > +const int m68k_numaliases = ARRAY_SIZE(m68k_opcode_aliases); > /* **** End of m68k-opc.c */ > /* **** floatformat.c from sourceware.org CVS 2005-08-14. */ > /* IEEE floating point support routines, for GDB, the GNU Debugger. > diff --git a/disas/ppc.c b/disas/ppc.c > index 5ab9c35a84..337415b887 100644 > --- a/disas/ppc.c > +++ b/disas/ppc.c > @@ -893,8 +893,7 @@ const struct powerpc_operand powerpc_operands[] = > { 0x1, 25, NULL, NULL, PPC_OPERAND_OPTIONAL}, > }; > > -const unsigned int num_powerpc_operands = (sizeof (powerpc_operands) > - / sizeof (powerpc_operands[0])); > +const unsigned int num_powerpc_operands = ARRAY_SIZE(powerpc_operands); > > /* The functions used to insert and extract complicated operands. */ > > @@ -5029,10 +5028,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { > > }; > > -const int powerpc_num_opcodes = > - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); > - > -/* The macro table. This is only used by the assembler. */ > +const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes); > +/* The macro table. This is only used by the assembler. */ > > /* The expressions of the form (-x ! 31) & (x | 31) have the value 0 > when x=0; 32-x when x is between 1 and 31; are negative if x is > @@ -5086,8 +5083,7 @@ const struct powerpc_macro powerpc_macros[] = { > { "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" }, > }; > > -const int powerpc_num_macros = > - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); > +const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros); > > > /* This file provides several disassembler functions, all of which use > diff --git a/disas/s390.c b/disas/s390.c > index 1f167d2eaa..ffa1519622 100644 > --- a/disas/s390.c > +++ b/disas/s390.c > @@ -1893,5 +1893,4 @@ static const struct s390_opcode s390_opcodes[] = > { "pr", OP16(0x0101LL), MASK_E, INSTR_E, 3, 0}, > }; > > -static const int s390_num_opcodes = > - sizeof (s390_opcodes) / sizeof (s390_opcodes[0]); > +static const int s390_num_opcodes = ARRAY_SIZE(s390_opcodes); -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature