diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2009-10-05 16:17:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-12 02:35:00 -0400 |
commit | cbef79a82a64ec13e745ce2b0274154ae1e47243 (patch) | |
tree | da128daca6c33c9280d0f01400c4766ed4a89c76 /tools/perf | |
parent | d93a8f829fe1d2f3002f2c6ddb553d12db420412 (diff) |
perf tools: Fix const char type propagation
The following perf build warnings/errors in function
argument types:
builtin-sched.c:1894: warning: passing argument 1 of 'sort_dimension__add' discards qualifiers from pointer target type
util/trace-event-parse.c:685: warning: passing argument 2 of 'read_expected' discards qualifiers from pointer target type
util/trace-event-parse.c:741: warning: passing argument 4 of 'test_type_token' discards qualifiers from pointer target type
util/trace-event-parse.c:706: warning: passing argument 2 of 'read_expected_item' discards qualifiers from pointer target type
... trigger because older GCC is not able to prove that
sort_dimension__add() does not change the string.
Some goes for test_type_token().
Fix this by improving type consistency.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091005131729.78444bfb.randy.dunlap@oracle.com>
[ Also remove ugly type cast now unnecessary. ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-sched.c | 4 | ||||
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index ea9c15c0cdfe..ce2d5be4f30e 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1287,7 +1287,7 @@ static struct sort_dimension *available_sorts[] = { | |||
1287 | 1287 | ||
1288 | static LIST_HEAD(sort_list); | 1288 | static LIST_HEAD(sort_list); |
1289 | 1289 | ||
1290 | static int sort_dimension__add(char *tok, struct list_head *list) | 1290 | static int sort_dimension__add(const char *tok, struct list_head *list) |
1291 | { | 1291 | { |
1292 | int i; | 1292 | int i; |
1293 | 1293 | ||
@@ -1917,7 +1917,7 @@ static void setup_sorting(void) | |||
1917 | 1917 | ||
1918 | free(str); | 1918 | free(str); |
1919 | 1919 | ||
1920 | sort_dimension__add((char *)"pid", &cmp_pid); | 1920 | sort_dimension__add("pid", &cmp_pid); |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | static const char *record_args[] = { | 1923 | static const char *record_args[] = { |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 55b41b9e3834..55c9659a56e2 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -618,7 +618,7 @@ static int test_type(enum event_type type, enum event_type expect) | |||
618 | } | 618 | } |
619 | 619 | ||
620 | static int test_type_token(enum event_type type, char *token, | 620 | static int test_type_token(enum event_type type, char *token, |
621 | enum event_type expect, char *expect_tok) | 621 | enum event_type expect, const char *expect_tok) |
622 | { | 622 | { |
623 | if (type != expect) { | 623 | if (type != expect) { |
624 | die("Error: expected type %d but read %d", | 624 | die("Error: expected type %d but read %d", |
@@ -650,7 +650,7 @@ static int read_expect_type(enum event_type expect, char **tok) | |||
650 | return __read_expect_type(expect, tok, 1); | 650 | return __read_expect_type(expect, tok, 1); |
651 | } | 651 | } |
652 | 652 | ||
653 | static int __read_expected(enum event_type expect, char *str, int newline_ok) | 653 | static int __read_expected(enum event_type expect, const char *str, int newline_ok) |
654 | { | 654 | { |
655 | enum event_type type; | 655 | enum event_type type; |
656 | char *token; | 656 | char *token; |
@@ -668,12 +668,12 @@ static int __read_expected(enum event_type expect, char *str, int newline_ok) | |||
668 | return 0; | 668 | return 0; |
669 | } | 669 | } |
670 | 670 | ||
671 | static int read_expected(enum event_type expect, char *str) | 671 | static int read_expected(enum event_type expect, const char *str) |
672 | { | 672 | { |
673 | return __read_expected(expect, str, 1); | 673 | return __read_expected(expect, str, 1); |
674 | } | 674 | } |
675 | 675 | ||
676 | static int read_expected_item(enum event_type expect, char *str) | 676 | static int read_expected_item(enum event_type expect, const char *str) |
677 | { | 677 | { |
678 | return __read_expected(expect, str, 0); | 678 | return __read_expected(expect, str, 0); |
679 | } | 679 | } |