[PATCH] target/ppc/cpu.h: Put macro parameter in parentheses

BALATON Zoltan posted 1 patch 5 years, 9 months ago
Test docker-quick@centos7 failed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200130021619.65FAB747871@zero.eik.bme.hu
Maintainers: David Gibson <david@gibson.dropbear.id.au>
target/ppc/cpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] target/ppc/cpu.h: Put macro parameter in parentheses
Posted by BALATON Zoltan 5 years, 9 months ago
Fix PPC_INPUT macro to work with more complex expressions by
protecting its argument with parentheses.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 target/ppc/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 8ebeaba649..e3a937e163 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -180,7 +180,7 @@ enum {
     POWERPC_EXCP_TRAP          = 0x40,
 };
 
-#define PPC_INPUT(env) (env->bus_model)
+#define PPC_INPUT(env) ((env)->bus_model)
 
 /*****************************************************************************/
 typedef struct opc_handler_t opc_handler_t;
-- 
2.21.1


Re: [PATCH] target/ppc/cpu.h: Put macro parameter in parentheses
Posted by David Gibson 5 years, 9 months ago
On Thu, Jan 30, 2020 at 03:06:18AM +0100, BALATON Zoltan wrote:
> Fix PPC_INPUT macro to work with more complex expressions by
> protecting its argument with parentheses.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>

Pretty unlikely to break anything in practice, but applied nonetheless.

> ---
>  target/ppc/cpu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 8ebeaba649..e3a937e163 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -180,7 +180,7 @@ enum {
>      POWERPC_EXCP_TRAP          = 0x40,
>  };
>  
> -#define PPC_INPUT(env) (env->bus_model)
> +#define PPC_INPUT(env) ((env)->bus_model)
>  
>  /*****************************************************************************/
>  typedef struct opc_handler_t opc_handler_t;

-- 
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