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

login
register
mail settings
Submitter Colin King
Date Oct. 25, 2012, 10:48 a.m.
Message ID <1351162111-31669-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/194113/
State Accepted
Headers show

Comments

Colin King - Oct. 25, 2012, 10:48 a.m.
From: Colin Ian King <colin.king@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@canonical.com>
---
 src/lib/include/fwts.h |    2 ++
 1 file changed, 2 insertions(+)
Alex Hung - Oct. 29, 2012, 6:44 a.m.
On 10/25/2012 06:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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"
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - Oct. 29, 2012, 5:35 p.m.
On 10/25/2012 06:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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"
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

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"