Skip to contentSkip to conversation

tracing: Fix warning on variable 'struct trace_array'

PATCH Applied Aashish Sharma 5 participants 5 messages Nov 7, 2022 – Nov 17, 2022 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix warning on variable 'struct trace_array'

Move the declaration of 'struct trace_array' out of #ifdef CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING is not set:

Quoted 1 line
Quoted 1 line

include/linux/trace.h:63:45: warning: 'struct trace_array' declared

inside parameter list will not be visible outside of this definition or declaration

Fixes 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc Arun Easi <[email protected]>
---
 include/linux/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/trace.h +2 -2
index b5e16e438448..80ffda871749 100644
@@ -26,13 +26,13 @@ struct trace_export {
 	int flags;
 };
 
+struct trace_array;
+
 #ifdef CONFIG_TRACING
 
 int register_ftrace_export(struct trace_export *export);
 int unregister_ftrace_export(struct trace_export *export);
 
-struct trace_array;
-
 void trace_printk_init_buffers(void);
 __printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,
Signature · 1 line
2.38.1.431.g37b22c650d-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Aashish Sharma

Move the declaration of 'struct trace_array' out of #ifdef CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING is not set:

Quoted 1 line
Quoted 1 line

include/linux/trace.h:63:45: warning: 'struct trace_array' declared

inside parameter list will not be visible outside of this definition or declaration

Fixes 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc Arun Easi <[email protected]>
Quoted 27 lines
---
 include/linux/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/trace.h +2 -2
index b5e16e438448..80ffda871749 100644
@@ -26,13 +26,13 @@ struct trace_export {
 	int flags;
 };
 
+struct trace_array;
+
 #ifdef CONFIG_TRACING
 
 int register_ftrace_export(struct trace_export *export);
 int unregister_ftrace_export(struct trace_export *export);
 
-struct trace_array;
-
 void trace_printk_init_buffers(void);
 __printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,
Signature · 1 line
2.38.1.431.g37b22c650d-goog
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Aashish Sharma
Quoted 8 lines · On Mon, 7 Nov 2022 21:35:56 +0530 Aashish Sharma <[email protected]> wrote:

Move the declaration of 'struct trace_array' out of #ifdef CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING is not set:

Quoted 1 line
Quoted 1 line

include/linux/trace.h:63:45: warning: 'struct trace_array' declared

inside parameter list will not be visible outside of this definition or declaration

This looks good to me.

Thank you!

Quoted 30 lines
Fixes 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc Arun Easi <[email protected]>
---
 include/linux/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/trace.h +2 -2
index b5e16e438448..80ffda871749 100644
@@ -26,13 +26,13 @@ struct trace_export {
 	int flags;
 };
 
+struct trace_array;
+
 #ifdef CONFIG_TRACING
 
 int register_ftrace_export(struct trace_export *export);
 int unregister_ftrace_export(struct trace_export *export);
 
-struct trace_array;
-
 void trace_printk_init_buffers(void);
 __printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,
Signature · 1 line
2.38.1.431.g37b22c650d-goog
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
#3 lore raw
In reply to Aashish Sharma
Quoted 28 lines · Aashish Sharma

----------------------------------------------------------------------
Move the declaration of 'struct trace_array' out of #ifdef CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING is not set:

Quoted 1 line
Quoted 1 line

include/linux/trace.h:63:45: warning: 'struct trace_array' declared

inside parameter list will not be visible outside of this definition or declaration

Fixes 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc Arun Easi <[email protected]>
---
 include/linux/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/trace.h +2 -0
index b5e16e438448..80ffda871749 100644
@@ -26,13 +26,13 @@ struct trace_export {
 	int flags;
 };
 
+struct trace_array;
+

include/linux/trace.h struct trace_export { · line 38

Quoted 10 lines
include/linux/trace.h +0 -2
 #ifdef CONFIG_TRACING
 
 int register_ftrace_export(struct trace_export *export);
 int unregister_ftrace_export(struct trace_export *export);
 
-struct trace_array;
-
 void trace_printk_init_buffers(void);
 __printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,

Looks good. Thanks!

I was wondering why I did not see this when I compiled the kernel without TRACING (for 1a77dd1c2bb5). Apparently, I had linux/trace_events.h included, which does exactly this. Anyway, makes sense to move this outside the #ifdef block.

Regards,
-Arun

maintainer Applied
#4 lore raw
In reply to Aashish Sharma
Quoted 4 lines · On Mon, 7 Nov 2022 21:35:56 +0530 Aashish Sharma <[email protected]> wrote:

Move the declaration of 'struct trace_array' out of #ifdef CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING is not set:

Quoted 8 lines
Quoted 1 line
Quoted 1 line

include/linux/trace.h:63:45: warning: 'struct trace_array' declared

inside parameter list will not be visible outside of this definition or declaration

Fixes 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc Arun Easi <[email protected]>

Queued. Thanks Aashish!

-- Steve