[PATCH 1/3] lib: fwts: add FWTS_UNUSED() macro for unused func arguments

Colin King colin.king at canonical.com
Thu Oct 25 10:48:29 UTC 2012


From: Colin Ian King <colin.king at canonical.com>

I'm hoping to use -Wextra in the near future to ensure code quality
is high.  Some of the fwts functions such as callbacks and fwts library
helper functions take arguments that we ignore.  To hint to gcc that
we're really ignoring these and to stop -Wextra breaking I'm adding
FWTS_UNUSED() to explicitly tell us that the argument is meant to be
ignored.

Example:

void fwts_somefunc(fwts_framework *fw, int dummy) {
	/* variable declarations here */

	FWTS_IGNORED(dummy);

	/* start of executable statements here */
	..
}

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/include/fwts.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
index a1e0fd2..b8d0670 100644
--- a/src/lib/include/fwts.h
+++ b/src/lib/include/fwts.h
@@ -24,6 +24,8 @@
 #define FWTS_ARCH_INTEL	1
 #endif
 
+#define FWTS_UNUSED(var)	(void)var
+
 #define FWTS_JSON_DATA_PATH	"/usr/share/fwts"
 
 #include "fwts_version.h"
-- 
1.7.10.4




More information about the fwts-devel mailing list