trace-cmd: compiler warning fixes
v2 cover trace-cmd: compiler warning fixes
The following series fixes a few minor compiler warnings. These are mostly printf format type issues. Also includes an uninitialized variable fix.
V2: actually send my patches and not 2 of rostedts... --
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
PATCH v2 1/3 trace-graph: fix printf compile warnings
--- trace-graph.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
trace-graph.c +2 -2
@@ -886,13 +886,13 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)trace_seq_init (&s); -dprintf (3 ,"start=%zu end=%zu time=%lu\n" , ginfo->start_time, ginfo->end_time, time); +dprintf (3 ,"start=%llu end=%llu time=%llu\n" , ginfo->start_time, ginfo->end_time, time); record =find_record_on_cpu (ginfo, cpu, time);if (record) { -dprintf (3 ,"record->ts=%llu time=%zu-%zu\n" , +dprintf (3 ,"record->ts=%llu time=%llu-%llu\n" , record->ts, time, time-(gint)(1 /ginfo->resolution));print_rec_info (record, pevent, cpu);
Signature · 1 line
1.6.3.3
PATCH v2 2/3 trace-cmd: fix printf compile warnings
In reply to Darren Hart--- trace-read.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
trace-read.c +1 -1
@@ -216,7 +216,7 @@ static void read_rest(void) r =read (input_fd, buf,BUFSIZ );if (r >0 ) { buf[r] =0 ; -printf (buf); +printf ("%s" , buf); } }while (r >0 ); }
Signature · 1 line
1.6.3.3
Re: [PATCH 2/3] trace-cmd: fix printf compile warnings
Quoted 19 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>---
trace-read.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)trace-read.c +1
-2@@ -216,7 +216,7 @@ static void read_rest(void) r = read(input_fd, buf, BUFSIZ); if (r > 0) { buf[r] = 0; - printf(buf); + printf("%s", buf); } } while (r > 0); } --
Quoted 2 lines
1.6.3.3
Oh! Obviously correct, thanks Darren.
Re: [PATCH 2/3] trace-cmd: fix printf compile warnings
Quoted 16 lines · John Kacur
Quoted 15 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>--- trace-read.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)trace-read.c +1
-1@@ -216,7 +216,7 @@ static void read_rest(void) r =read (input_fd, buf,BUFSIZ );if (r >0 ) { buf[r] =0 ; -printf (buf); +printf ("%s" , buf);
Quoted 8 lines
Quoted 6 lines
trace-read.c +0
-1} }while (r >0 ); } --1.6.3.3
Oh! Obviously correct, thanks Darren.
Of the three patches, I think this is the only one that is correct ;-)
-- Steve
Re: [PATCH 2/3] trace-cmd: fix printf compile warnings
Quoted 26 lines · Steven Rostedt
Quoted 16 lines · John Kacur
Quoted 15 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>---
trace-read.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)trace-read.c +1
-1@@ -216,7 +216,7 @@ static void read_rest(void) r = read(input_fd, buf, BUFSIZ); if (r > 0) { buf[r] = 0; - printf(buf); + printf("%s", buf);Quoted 8 lines
Quoted 6 lines
trace-read.c +0
-1} } while (r > 0); } --1.6.3.3
Oh! Obviously correct, thanks Darren.
Quoted 2 lines
Of the three patches, I think this is the only one that is correct ;-)
Ah, you're a hard taskmaster! Are you going to push it to your repo for us then pls?
Re: [PATCH 2/3] trace-cmd: fix printf compile warnings
In reply to Steven RostedtQuoted 25 lines · Steven Rostedt
Quoted 15 lines · John Kacur
Quoted 14 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>--- trace-read.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)trace-read.c +0
-1@@ -216,7 +216,7 @@ static void read_rest(void) r =read (input_fd, buf,BUFSIZ );if (r >0 ) { buf[r] =0 ; -printf (buf);Quoted 8 lines
Quoted 7 lines
trace-read.c +1
-1+printf ("%s" , buf); } }while (r >0 ); } --1.6.3.3
Oh! Obviously correct, thanks Darren.
Quoted 1 line
Of the three patches, I think this is the only one that is correct ;-)
The other appear to depend on the guint arch specific implementation of the guint64 type, so the only way to fix it with a cast to ull - or to not use g types at all. Bleh.
Signature · 3 lines
Darren Hart IBM Linux Technology Center Real-Time Linux Team
Re: [PATCH 2/3] trace-cmd: fix printf compile warnings
Quoted 5 lines · Darren Hart
Quoted 1 line
Of the three patches, I think this is the only one that is correct ;-)
The other appear to depend on the guint arch specific implementation of the guint64 type, so the only way to fix it with a cast to ull - or to not use g types at all. Bleh.
I'm fixing it up by typecasting it to (u64), and defining it.
I probably should never have used guint64 but since that's the "glib" thing to do, and when in Rome do as the Romans do, even if the Romans are doing crap!
-- Steve
PATCH v2 3/3 kernel-shark: fix unitialized handle compile warnings
In reply to Darren Hart--- kernel-shark.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
kernel-shark.c +3 -3
@@ -596,10 +596,10 @@ void kernel_shark(int argc, char **argv)if (ret >=0 ) input_file = default_input_file; } -if (handle) - handle =tracecmd_open (input_file); + handle =tracecmd_open (input_file); - info->handle = handle; +if (handle) + info->handle = handle;/* --- Main window --- */
Signature · 1 line
1.6.3.3
Re: [PATCH 3/3] kernel-shark: fix unitialized handle compile warnings
Quoted 14 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>---
kernel-shark.c | 6 +++---1 files changed, 3 insertions(+), 3 deletions(-)kernel-shark.c +0
-1@@ -596,10 +596,10 @@ void kernel_shark(int argc, char **argv) if (ret >= 0) input_file = default_input_file; } - if (handle)
kernel-shark.c void kernel_shark(int argc, char **argv)
Quoted 10 lines
kernel-shark.c +3
-3- handle = tracecmd_open(input_file); + handle = tracecmd_open(input_file); - info->handle = handle; + if (handle) + info->handle = handle; /* --- Main window --- */ --
This looks correct, but I'm wondering if it is safe to continue if the call to tracecmd_open fails?
Re: [PATCH 3/3] kernel-shark: fix unitialized handle compile warnings
Quoted 22 lines · John Kacur
Quoted 21 lines · Darren Hart
Signed-off-by Darren Hart <[email protected]>--- kernel-shark.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)kernel-shark.c +3
-3@@ -596,10 +596,10 @@ void kernel_shark(int argc, char **argv)if (ret >=0 ) input_file = default_input_file; } -if (handle) - handle =tracecmd_open (input_file); + handle =tracecmd_open (input_file); - info->handle = handle; +if (handle) + info->handle = handle;
Quoted 6 lines
kernel-shark.c void kernel_shark(int argc, char **argv)
Quoted 3 lines
kernel-shark.c +0
-1/* --- Main window --- */ --This looks correct, but I'm wondering if it is safe to continue if the call to
tracecmd_openfails?
Actually this patch is wrong. The real code should be:
- if (handle)
+ if (input_file)
-- Steve
Re: [PATCH 3/3] kernel-shark: fix unitialized handle compile warnings
Quoted 17 lines · Steven Rostedt
andle)
Quoted 7 lines
Quoted 7 lines
kernel-shark.c +3
-2- handle =tracecmd_open (input_file); + handle =tracecmd_open (input_file); - info->handle = handle; +if (handle) + info->handle = handle;Quoted 6 lines
Quoted 3 lines
/* --- Main window --- */--
This looks correct, but I'm wondering if it is safe to continue if the call to
tracecmd_openfails?Actually this patch is wrong. The real code should be:
Review
Quoted 2 lines
(quoted diff) +1
-1- if (handle) + if (input_file)
Looking at the context, this isn't enough. We should have had:
if (input_file) info->handle = tracecmd_open(input_file); else info->handle = NULL;
-- Steve
Re: [PATCH 3/3] kernel-shark: fix unitialized handle compile warnings
Quoted 21 lines · Steven Rostedt
Quoted 12 lines · Steven Rostedt
andle)
Quoted 11 lines
Quoted 10 lines
- handle =
tracecmd_open(input_file);
+ handle =tracecmd_open(input_file);-
info->handle= handle;
+ if (handle)
+info->handle= handle;/* --- Main window --- */
--
Quoted 7 lines
Quoted 2 lines
This looks correct, but I'm wondering if it is safe to continue if the call to
tracecmd_openfails?Actually this patch is wrong. The real code should be:
- if (handle)
+ if (input_file)
Quoted 9 lines
Looking at the context, this isn't enough. We should have had:
if (
input_file)
info->handle =tracecmd_open(input_file); else
info->handle = NULL;-- Steve
Okay, are you going to push it to your repo for us? I would offer to push it through mine if it would save you time, but it's probably quicker if you just handle it.
Re: [PATCH 3/3] kernel-shark: fix unitialized handle compile warnings
Quoted 4 lines · John Kacur
Okay, are you going to push it to your repo for us? I would offer to push it through mine if it would save you time, but it's probably quicker if you just handle it.
Yeah, I'll pull via email the one patch and then do this one by hand.
-- Steve
Steven,
You can pull these from the latest for-rostedt/master git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/dvhart/trace-cmd.git for-rostedt/master
Quoted 16 lines · Darren Hart
The following series fixes a few minor compiler warnings. These are mostly printf format type issues. Also includes an uninitialized variable fix.
V2: actually send my patches and not 2 of rostedts... --
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
Darren Hart IBM Linux Technology Center Real-Time Linux Team