From 3813634dc98f3b77122bb1fcc17f818f08521225 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 29 Mar 2021 14:08:03 +0800 Subject: [PATCH] Refine UNUSED macro to avoid any side effect Signed-off-by: Xiang Xiao Change-Id: I35d858fc6fb2e0e24b993ab7dd2203c9dd35232a --- include/nuttx/compiler.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index a42db0352c1..5cc45930e78 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -49,7 +49,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) /* Built-in functions */ @@ -301,7 +301,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) /* SDCC-specific definitions ************************************************/ @@ -394,7 +394,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) /* It is assumed that the system is build using the small * data model with storage defaulting to internal RAM. @@ -447,7 +447,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) /* Zilog-specific definitions ***********************************************/ @@ -578,7 +578,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) /* ICCARM-specific definitions **********************************************/ @@ -590,7 +590,7 @@ /* Indicate that a local variable is not used */ -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) # define weak_alias(name, aliasname) # define weak_data __weak @@ -686,7 +686,7 @@ # undef CONFIG_HAVE_ANONYMOUS_STRUCT # undef CONFIG_HAVE_ANONYMOUS_UNION -# define UNUSED(a) ((void)(a)) +# define UNUSED(a) ((void)(1 || (a))) #endif