From: John Kacur <jkacur@redhat.com>
To: Eder Zulian <ezulian@redhat.com>
Cc: linux-rt-users@vger.kernel.org, williams@redhat.com
Subject: Re: [PATCH] rt-tests: cyclictest: Suppress compiler warnings for unused variables
Date: Wed, 9 Aug 2023 14:49:32 -0400 (EDT) [thread overview]
Message-ID: <cbbb28e6-4c55-e16d-7afa-d4c4f61bc4a@redhat.com> (raw)
In-Reply-To: <20230808223904.290605-1-ezulian@redhat.com>
On Wed, 9 Aug 2023, Eder Zulian wrote:
> Using an attribute to inform the compiler that variables are expect to be unused so it will not issue a warning.
>
> Signed-off-by: Eder Zulian <ezulian@redhat.com>
> ---
> src/cyclictest/cyclictest.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 7b0f80f..86cec0e 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1610,11 +1610,13 @@ static void rstat_print_stat(struct thread_param *par, int index, int verbose, i
> }
>
>
> +#define UNUSED __attribute__((__unused__))
> +
> /*
> * thread that creates a named fifo and hands out run stats when someone
> * reads from the fifo.
> */
> -static void *fifothread(void *param)
> +static void *fifothread(UNUSED void *param)
> {
> int ret;
> int fd;
> @@ -1795,7 +1797,7 @@ rstat_err:
> return;
> }
>
> -static void write_stats(FILE *f, void *data)
> +static void write_stats(FILE *f, UNUSED void *data)
> {
> struct thread_param **par = parameters;
> unsigned int i, j, comma;
> --
> 2.39.3
>
>
Just like in the kernel, we try to avoid preprocessor trickery,
so just put the attribute directly in the function header.
Watch the unwrapped lines in your commit messages.
John
prev parent reply other threads:[~2023-08-09 18:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 22:39 [PATCH] rt-tests: cyclictest: Suppress compiler warnings for unused variables Eder Zulian
2023-08-09 18:49 ` John Kacur [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbbb28e6-4c55-e16d-7afa-d4c4f61bc4a@redhat.com \
--to=jkacur@redhat.com \
--cc=ezulian@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).