* [PATCH] trace/osnoise: Do not use 'main' as variable name
@ 2021-09-08 15:14 Guenter Roeck
2021-09-08 15:53 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2021-09-08 15:14 UTC (permalink / raw)
To: Steven Rostedt
Cc: Daniel Bristot de Oliveira, Ingo Molnar, linux-kernel, Guenter Roeck
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.
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");
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] trace/osnoise: Do not use 'main' as variable name
2021-09-08 15:14 [PATCH] trace/osnoise: Do not use 'main' as variable name Guenter Roeck
@ 2021-09-08 15:53 ` Steven Rostedt
2021-09-08 16:09 ` Randy Dunlap
2021-09-08 16:34 ` Guenter Roeck
0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2021-09-08 15:53 UTC (permalink / raw)
To: Guenter Roeck
Cc: Daniel Bristot de Oliveira, Ingo Molnar, linux-kernel,
Linus Torvalds, Randy Dunlap
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");
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] trace/osnoise: Do not use 'main' as variable name
2021-09-08 15:53 ` Steven Rostedt
@ 2021-09-08 16:09 ` Randy Dunlap
2021-09-08 16:34 ` Guenter Roeck
1 sibling, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2021-09-08 16:09 UTC (permalink / raw)
To: Steven Rostedt, Guenter Roeck
Cc: Daniel Bristot de Oliveira, Ingo Molnar, linux-kernel, Linus Torvalds
On 9/8/21 8:53 AM, Steven Rostedt wrote:
> 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");
>
Preferably Linus's version:
https://lore.kernel.org/all/73ee98a4-c4a5-04f3-6280-dcd67507d889@infradead.org/
--
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] trace/osnoise: Do not use 'main' as variable name
2021-09-08 15:53 ` Steven Rostedt
2021-09-08 16:09 ` Randy Dunlap
@ 2021-09-08 16:34 ` Guenter Roeck
2021-09-08 16:35 ` Linus Torvalds
1 sibling, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2021-09-08 16:34 UTC (permalink / raw)
To: Steven Rostedt
Cc: Daniel Bristot de Oliveira, Ingo Molnar, linux-kernel,
Linus Torvalds, Randy Dunlap
On 9/8/21 8:53 AM, Steven Rostedt wrote:
> 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/
>
No problem. Sorry, I didn't find the other patch.
FWIW, it wasn't gcc 11.x, it was gcc 8.1, which is the only gcc version
that I can get to compile nds32 images (more recent versions either fail
to compile gcc, or fail to build the kernel with assembler errors).
I'll just stop build testing nds32:allmodconfig instead.
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] trace/osnoise: Do not use 'main' as variable name
2021-09-08 16:34 ` Guenter Roeck
@ 2021-09-08 16:35 ` Linus Torvalds
0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2021-09-08 16:35 UTC (permalink / raw)
To: Guenter Roeck
Cc: Steven Rostedt, Daniel Bristot de Oliveira, Ingo Molnar,
Linux Kernel Mailing List, Randy Dunlap
On Wed, Sep 8, 2021 at 9:34 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> FWIW, it wasn't gcc 11.x, it was gcc 8.1, which is the only gcc version
> that I can get to compile nds32 images (more recent versions either fail
> to compile gcc, or fail to build the kernel with assembler errors).
> I'll just stop build testing nds32:allmodconfig instead.
I'm actually just about to go back to that patch, since I have been
reminded about it independently by a couple of emails now.
So the 'main' noise will go away shortly.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-08 16:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 15:14 [PATCH] trace/osnoise: Do not use 'main' as variable name Guenter Roeck
2021-09-08 15:53 ` Steven Rostedt
2021-09-08 16:09 ` Randy Dunlap
2021-09-08 16:34 ` Guenter Roeck
2021-09-08 16:35 ` Linus Torvalds
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.