qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-trivial@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
	Laurent Vivier <laurent@vivier.eu>,
	Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Eric Blake <eblake@redhat.com>
Subject: Re: [Qemu-trivial] [PATCH 20/29] disas: use ARRAY_SIZE macro
Date: Tue, 18 Jul 2017 16:49:26 +1000	[thread overview]
Message-ID: <20170718064926.GF3140@umbus.fritz.box> (raw)
In-Reply-To: <20170718061005.29518-21-f4bug@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 4538 bytes --]

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é <f4bug@amsat.org>

ppc parts,

Acked-by: David Gibson <david@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]);
> -\f
> -/* 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-07-18 11:09 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  6:09 [Qemu-trivial] [PATCH 00/29] coccinelle script to enforce qemu/osdep.h macros usage Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 01/29] coccinelle: add a " Philippe Mathieu-Daudé
2017-07-18 15:18   ` Eric Blake
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 02/29] pci: remove superfluous parenthesis Philippe Mathieu-Daudé
2017-07-19  0:16   ` [Qemu-trivial] [Qemu-devel] " Richard Henderson
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro Philippe Mathieu-Daudé
2017-07-18 15:19   ` Eric Blake
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 04/29] scsi-disk: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 05/29] block: " Philippe Mathieu-Daudé
2017-07-18  9:59   ` Juan Quintela
2017-07-18 15:25   ` Eric Blake
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 06/29] migration/block: " Philippe Mathieu-Daudé
2017-07-18  9:58   ` Juan Quintela
2017-07-18 11:19     ` [Qemu-trivial] [Qemu-devel] " Alex Bennée
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 07/29] ds1338: " Philippe Mathieu-Daudé
2017-07-18 10:23   ` Alastair D'Silva
2017-07-18 13:23     ` Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 08/29] ui: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 09/29] net: " Philippe Mathieu-Daudé
2017-07-18 17:51   ` Eric Blake
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 10/29] net/rocker: " Philippe Mathieu-Daudé
2017-07-18 17:51   ` Eric Blake
2017-07-21 16:23     ` Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 11/29] s390x/sclp: " Philippe Mathieu-Daudé
2017-07-18  9:58   ` Cornelia Huck
2017-07-18 10:03     ` Cornelia Huck
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 12/29] sm501: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 13/29] tcg: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 14/29] cris: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 16/29] lm32: " Philippe Mathieu-Daudé
2017-07-18 11:42   ` Michael Walle
2017-07-18 14:37     ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
2017-07-21 16:29       ` Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 18/29] nios2: " Philippe Mathieu-Daudé
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 19/29] disas: " Philippe Mathieu-Daudé
2017-07-18 11:07   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 14:43     ` Thomas Huth
2017-07-23 14:52       ` Paolo Bonzini
2017-07-24 12:16         ` Eric Blake
2017-07-18 11:09   ` [Qemu-trivial] " Michael Tokarev
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 20/29] disas: use ARRAY_SIZE macro Philippe Mathieu-Daudé
2017-07-18  6:49   ` David Gibson [this message]
2017-07-18 10:55   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 21/29] qga: " Philippe Mathieu-Daudé
2017-07-18 11:29   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 22/29] vmsvga: " Philippe Mathieu-Daudé
2017-07-18 11:28   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18  6:09 ` [Qemu-trivial] [PATCH 23/29] async: " Philippe Mathieu-Daudé
2017-07-18 10:54   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 24/29] tests/acpi: " Philippe Mathieu-Daudé
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 25/29] libqos: " Philippe Mathieu-Daudé
2017-07-18 11:00   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 11:58   ` [Qemu-trivial] " Laurent Vivier
2017-07-18 13:36     ` Philippe Mathieu-Daudé
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 26/29] tests/tcg: " Philippe Mathieu-Daudé
2017-07-18 10:56   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 11:16     ` Alex Bennée
2017-07-18 11:24       ` Marc-André Lureau
2017-07-18 13:52         ` Alex Bennée
2017-07-18 13:41       ` Philippe Mathieu-Daudé
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 27/29] tests/hbitmap: " Philippe Mathieu-Daudé
2017-07-18 10:52   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 15:36   ` John Snow
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 28/29] tests/qapi: use QEMU_IS_ALIGNED macro Philippe Mathieu-Daudé
2017-07-18 10:53   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18  6:10 ` [Qemu-trivial] [PATCH 29/29] tests/qapi: use ARRAY_SIZE macro Philippe Mathieu-Daudé
2017-07-18 10:52   ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
     [not found] ` <20170718061005.29518-16-f4bug@amsat.org>
2017-07-18 11:08   ` [Qemu-trivial] [Qemu-devel] [PATCH 15/29] microblaze: use QEMU_IS_ALIGNED macro Marc-André Lureau
2017-07-18 14:46     ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170718064926.GF3140@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=eblake@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).