You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/04 08:34:54 UTC

[incubator-nuttx] branch master updated: optimize UNUSED macro

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0083a2e4f2 optimize UNUSED macro
0083a2e4f2 is described below

commit 0083a2e4f29ac8574eeda895803f2a7447d89680
Author: liyi <li...@xiaomi.com>
AuthorDate: Thu Aug 4 14:54:31 2022 +0800

    optimize UNUSED macro
    
    Signed-off-by: liyi <li...@xiaomi.com>
---
 include/nuttx/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 5aef5b519e..6fd4524789 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -385,7 +385,7 @@
 
 /* Indicate that a local variable is not used */
 
-#  define UNUSED(a) ((void)(1 || (a)))
+#  define UNUSED(a) ((void)(1 || &(a)))
 
 #  if defined(__clang__)
 #    define no_builtin(n) __attribute__((no_builtin(n)))
@@ -485,7 +485,7 @@
 
 /* Indicate that a local variable is not used */
 
-#  define UNUSED(a) ((void)(1 || (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.
@@ -654,7 +654,7 @@
 
 /* Indicate that a local variable is not used */
 
-#  define UNUSED(a) ((void)(1 || (a)))
+#  define UNUSED(a) ((void)(1 || &(a)))
 
 /* Older Zilog compilers support both types double and long long, but the
  * size is 32-bits (same as long and single precision) so it is safer to say
@@ -721,7 +721,7 @@
 
 /* Indicate that a local variable is not used */
 
-#  define UNUSED(a) ((void)(1 || (a)))
+#  define UNUSED(a) ((void)(1 || &(a)))
 
 #  define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */
 #  define CONFIG_HAVE_FILENAME 1    /* Has __FILE__ */
@@ -783,7 +783,7 @@
 #  undef  CONFIG_HAVE_DOUBLE
 #  undef  CONFIG_HAVE_LONG_DOUBLE
 
-#  define UNUSED(a) ((void)(1 || (a)))
+#  define UNUSED(a) ((void)(1 || &(a)))
 
 #  define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))