[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191021063122.GC27784@unicorn.suse.cz>
Date: Mon, 21 Oct 2019 08:31:22 +0200
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Maciej Żenczykowski <zenczykowski@...il.com>,
Maciej Żenczykowski <maze@...gle.com>,
"John W . Linville" <linville@...driver.com>
Subject: Re: [PATCH 02/33] fix unused parameter warnings in do_version() and
show_usage()
On Thu, Oct 17, 2019 at 11:20:50AM -0700, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@...gle.com>
>
> This fixes:
> external/ethtool/ethtool.c:473:43: error: unused parameter 'ctx' [-Werror,-Wunused-parameter]
> static int do_version(struct cmd_context *ctx)
>
> external/ethtool/ethtool.c:5392:43: error: unused parameter 'ctx' [-Werror,-Wunused-parameter]
> static int show_usage(struct cmd_context *ctx)
>
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
> Change-Id: I0cc52f33bb0e8d7627f5e84bb4e3dfa821d17cc8
> ---
> ethtool.c | 4 ++--
> internal.h | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/ethtool.c b/ethtool.c
> index 082e37f..5e0deda 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -470,7 +470,7 @@ static int rxflow_str_to_type(const char *str)
> return flow_type;
> }
>
> -static int do_version(struct cmd_context *ctx)
> +static int do_version(struct cmd_context *ctx maybe_unused)
> {
Considering how frequent this pattern (a callback where not all
instances use all parameters) is, maybe we could consider disabling the
warning with -Wno-unused-parameter instead of marking all places where
it is issued.
Michal Kubecek
> fprintf(stdout,
> PACKAGE " version " VERSION
> @@ -5484,7 +5484,7 @@ static const struct option {
> {}
> };
>
> -static int show_usage(struct cmd_context *ctx)
> +static int show_usage(struct cmd_context *ctx maybe_unused)
> {
> int i;
>
> diff --git a/internal.h b/internal.h
> index aecf1ce..ff52c6e 100644
> --- a/internal.h
> +++ b/internal.h
> @@ -23,6 +23,8 @@
> #include <sys/ioctl.h>
> #include <net/if.h>
>
> +#define maybe_unused __attribute__((__unused__))
> +
> /* ethtool.h expects these to be defined by <linux/types.h> */
> #ifndef HAVE_BE_TYPES
> typedef uint16_t __be16;
> --
> 2.23.0.866.gb869b98d4c-goog
>
Powered by blists - more mailing lists