From 88d7a62b4dc634adc252e8e5901f981803717b2b Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 23 Mar 2021 02:39:51 +0000 Subject: [PATCH] cleanup: fix redundant NOT_USED macro redefinition (re: 733f70e9) The NOT_USED() macro is already defined in ast.h (which is included by shell.h) as an alias of NoP(). So it's better to apply the fix to NoP() so it takes effect for both verrsions, for libast and ksh. --- src/cmd/ksh93/include/shell.h | 12 ------------ src/lib/libast/include/ast.h | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/cmd/ksh93/include/shell.h b/src/cmd/ksh93/include/shell.h index 900df6145..4619838fa 100644 --- a/src/cmd/ksh93/include/shell.h +++ b/src/cmd/ksh93/include/shell.h @@ -37,18 +37,6 @@ # include #endif /* _SH_PRIVATE */ -/* - * This is a macro that can be used to silence "unused parameter" warnings from the compiler for - * functions which need to accept parameters they do not use because they need to be compatible - * with an interface. - */ -#undef NOT_USED -#define NOT_USED(expr) \ - do { \ - (void)(expr); \ - } while (0) - - /* options */ typedef struct { diff --git a/src/lib/libast/include/ast.h b/src/lib/libast/include/ast.h index c4ca23b0c..00aa5fd80 100644 --- a/src/lib/libast/include/ast.h +++ b/src/lib/libast/include/ast.h @@ -228,7 +228,7 @@ typedef struct #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) #define NiL 0 -#define NoP(x) (void)(x) +#define NoP(x) do (void)(x); while(0) /* for silencing "unused parameter" warnings */ #else #define NiL ((char*)0) #define NoP(x) (&x,1)