trace/osnoise: Do not use 'main' as variable name
Subsystems (2)
PATCH 1/1 trace/osnoise: Do not use 'main' as variable name
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.
--- kernel/trace/trace_osnoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +3 -3
@@ -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" );
Signature · 1 line
2.33.0
Steven Rostedt
maintainerQuoted 6 lines · On Wed, 8 Sep 2021 08:14:07 -0700 Guenter Roeck <[email protected]> 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 functionUse 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/[email protected]/
-- Steve
Quoted 34 lines
Signed-off-by Guenter Roeck <[email protected]>--- kernel/trace/trace_osnoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/trace/trace_osnoise.c +3
-3@@ -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" );
Quoted 62 lines · Steven Rostedt
Quoted 6 lines · On Wed, 8 Sep 2021 08:14:07 -0700 Guenter Roeck <[email protected]> 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 functionUse 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/[email protected]/-- Steve
Quoted 32 lines
Signed-off-by Guenter Roeck <[email protected]>--- kernel/trace/trace_osnoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/trace/trace_osnoise.c +3
-3@@ -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);
Quoted 3 lines
kernel/trace/trace_osnoise.c static void stop_per_cpu_kthreads(void) · line 1531
Quoted 2 lines
kernel/trace/trace_osnoise.c +0
-0if (IS_ERR (kthread)) {pr_err (BANNER "could not start sampling thread\n" );
Preferably Linus's version:
https://lore.kernel.org/all/[email protected]/
Signature · 1 line
~Randy
Quoted 18 lines · Steven Rostedt
Quoted 6 lines · On Wed, 8 Sep 2021 08:14:07 -0700 Guenter Roeck <[email protected]> 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 functionUse 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"!!!!
Quoted 8 lines
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/[email protected]/
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
Quoted 5 lines · Guenter Roeck
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