From: Steven Rostedt <rostedt@goodmis.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH] trace/osnoise: Do not use 'main' as variable name
Date: Wed, 8 Sep 2021 11:53:50 -0400 [thread overview]
Message-ID: <20210908115350.555941ba@oasis.local.home> (raw)
In-Reply-To: <20210908151407.217052-1-linux@roeck-us.net>
On Wed, 8 Sep 2021 08:14:07 -0700
Guenter Roeck <linux@roeck-us.net> wrote:
> gcc 11.x may get a hiccup when encountering 'main' as variable name.
>
> kernel/trace/trace_osnoise.c: In function 'start_kthread':
> kernel/trace/trace_osnoise.c:1515:8: error: 'main' is usually a function
>
> Use a different variable name to silence it.
Egad, no. NACK! Double NACK. Linus already NACK'd this.
(although it's ironic that he also added -Werror as the default :-/ )
The bug in is in gcc, go send them a patch.
THERE IS NO ISSUE WITH HAVING A LOCAL VARIABLE NAMED "main"!!!!
This has already been discussed:
https://lore.kernel.org/all/CAHk-=whHxeUjaNrWOLb0qx=-nibRZzQomwkw9xMPH_aHCf=BWQ@mail.gmail.com/
For now, the workaround is this patch:
https://lore.kernel.org/all/20210813224131.25803-1-rdunlap@infradead.org/
-- Steve
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> kernel/trace/trace_osnoise.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 65b08b8e5bf8..7a4c73b4fdcf 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -1512,20 +1512,20 @@ static void stop_per_cpu_kthreads(void)
> static int start_kthread(unsigned int cpu)
> {
> struct task_struct *kthread;
> - void *main = osnoise_main;
> + void *func = osnoise_main;
> char comm[24];
>
> #ifdef CONFIG_TIMERLAT_TRACER
> if (osnoise_data.timerlat_tracer) {
> snprintf(comm, 24, "timerlat/%d", cpu);
> - main = timerlat_main;
> + func = timerlat_main;
> } else {
> snprintf(comm, 24, "osnoise/%d", cpu);
> }
> #else
> snprintf(comm, 24, "osnoise/%d", cpu);
> #endif
> - kthread = kthread_create_on_cpu(main, NULL, cpu, comm);
> + kthread = kthread_create_on_cpu(func, NULL, cpu, comm);
>
> if (IS_ERR(kthread)) {
> pr_err(BANNER "could not start sampling thread\n");
next prev parent reply other threads:[~2021-09-08 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 15:14 [PATCH] trace/osnoise: Do not use 'main' as variable name Guenter Roeck
2021-09-08 15:53 ` Steven Rostedt [this message]
2021-09-08 16:09 ` Randy Dunlap
2021-09-08 16:34 ` Guenter Roeck
2021-09-08 16:35 ` Linus Torvalds
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=20210908115350.555941ba@oasis.local.home \
--to=rostedt@goodmis.org \
--cc=bristot@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mingo@redhat.com \
--cc=rdunlap@infradead.org \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.