diff options
author | Jiri Olsa <jolsa@redhat.com> | 2015-09-29 11:05:31 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-30 17:34:23 -0400 |
commit | 272ed29a91aea4397c05157dea7210dd7e81557a (patch) | |
tree | 377021e3bbfbd3b0c77fe2b1452396f98692b5a3 /tools/perf/util/parse-events.c | |
parent | 45633a169571e81835ec53fe0c089dd20f3195f1 (diff) |
perf tools: Fix shadowed declaration in parse-events.c
The error variable breaks build on CentOS 6.7, due to a collision with a
global error symbol:
CC util/parse-events.o
cc1: warnings being treated as errors
util/parse-events.c:419: error: declaration of ‘error’ shadows a global
declaration
util/util.h:135: error: shadowed declaration is here
util/parse-events.c: In function ‘add_tracepoint_multi_event’:
...
Using different argument names instead to fix it.
Reported-by: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: linux-tip-commits@vger.kernel.org
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150929150531.GI27383@krava.redhat.com
[ Fix one more case, at line 770 ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 5ffb356cbcc6..c1c64fb647aa 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -389,7 +389,7 @@ int parse_events_add_cache(struct list_head *list, int *idx, | |||
389 | return add_event(list, idx, &attr, name, NULL); | 389 | return add_event(list, idx, &attr, name, NULL); |
390 | } | 390 | } |
391 | 391 | ||
392 | static void tracepoint_error(struct parse_events_error *error, int err, | 392 | static void tracepoint_error(struct parse_events_error *e, int err, |
393 | char *sys, char *name) | 393 | char *sys, char *name) |
394 | { | 394 | { |
395 | char help[BUFSIZ]; | 395 | char help[BUFSIZ]; |
@@ -402,30 +402,30 @@ static void tracepoint_error(struct parse_events_error *error, int err, | |||
402 | 402 | ||
403 | switch (err) { | 403 | switch (err) { |
404 | case EACCES: | 404 | case EACCES: |
405 | error->str = strdup("can't access trace events"); | 405 | e->str = strdup("can't access trace events"); |
406 | break; | 406 | break; |
407 | case ENOENT: | 407 | case ENOENT: |
408 | error->str = strdup("unknown tracepoint"); | 408 | e->str = strdup("unknown tracepoint"); |
409 | break; | 409 | break; |
410 | default: | 410 | default: |
411 | error->str = strdup("failed to add tracepoint"); | 411 | e->str = strdup("failed to add tracepoint"); |
412 | break; | 412 | break; |
413 | } | 413 | } |
414 | 414 | ||
415 | tracing_path__strerror_open_tp(err, help, sizeof(help), sys, name); | 415 | tracing_path__strerror_open_tp(err, help, sizeof(help), sys, name); |
416 | error->help = strdup(help); | 416 | e->help = strdup(help); |
417 | } | 417 | } |
418 | 418 | ||
419 | static int add_tracepoint(struct list_head *list, int *idx, | 419 | static int add_tracepoint(struct list_head *list, int *idx, |
420 | char *sys_name, char *evt_name, | 420 | char *sys_name, char *evt_name, |
421 | struct parse_events_error *error __maybe_unused, | 421 | struct parse_events_error *err, |
422 | struct list_head *head_config) | 422 | struct list_head *head_config) |
423 | { | 423 | { |
424 | struct perf_evsel *evsel; | 424 | struct perf_evsel *evsel; |
425 | 425 | ||
426 | evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++); | 426 | evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++); |
427 | if (IS_ERR(evsel)) { | 427 | if (IS_ERR(evsel)) { |
428 | tracepoint_error(error, PTR_ERR(evsel), sys_name, evt_name); | 428 | tracepoint_error(err, PTR_ERR(evsel), sys_name, evt_name); |
429 | return PTR_ERR(evsel); | 429 | return PTR_ERR(evsel); |
430 | } | 430 | } |
431 | 431 | ||
@@ -443,7 +443,7 @@ static int add_tracepoint(struct list_head *list, int *idx, | |||
443 | 443 | ||
444 | static int add_tracepoint_multi_event(struct list_head *list, int *idx, | 444 | static int add_tracepoint_multi_event(struct list_head *list, int *idx, |
445 | char *sys_name, char *evt_name, | 445 | char *sys_name, char *evt_name, |
446 | struct parse_events_error *error, | 446 | struct parse_events_error *err, |
447 | struct list_head *head_config) | 447 | struct list_head *head_config) |
448 | { | 448 | { |
449 | char evt_path[MAXPATHLEN]; | 449 | char evt_path[MAXPATHLEN]; |
@@ -454,7 +454,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx, | |||
454 | snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); | 454 | snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); |
455 | evt_dir = opendir(evt_path); | 455 | evt_dir = opendir(evt_path); |
456 | if (!evt_dir) { | 456 | if (!evt_dir) { |
457 | tracepoint_error(error, errno, sys_name, evt_name); | 457 | tracepoint_error(err, errno, sys_name, evt_name); |
458 | return -1; | 458 | return -1; |
459 | } | 459 | } |
460 | 460 | ||
@@ -469,7 +469,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx, | |||
469 | continue; | 469 | continue; |
470 | 470 | ||
471 | ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, | 471 | ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, |
472 | error, head_config); | 472 | err, head_config); |
473 | } | 473 | } |
474 | 474 | ||
475 | closedir(evt_dir); | 475 | closedir(evt_dir); |
@@ -478,19 +478,19 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx, | |||
478 | 478 | ||
479 | static int add_tracepoint_event(struct list_head *list, int *idx, | 479 | static int add_tracepoint_event(struct list_head *list, int *idx, |
480 | char *sys_name, char *evt_name, | 480 | char *sys_name, char *evt_name, |
481 | struct parse_events_error *error, | 481 | struct parse_events_error *err, |
482 | struct list_head *head_config) | 482 | struct list_head *head_config) |
483 | { | 483 | { |
484 | return strpbrk(evt_name, "*?") ? | 484 | return strpbrk(evt_name, "*?") ? |
485 | add_tracepoint_multi_event(list, idx, sys_name, evt_name, | 485 | add_tracepoint_multi_event(list, idx, sys_name, evt_name, |
486 | error, head_config) : | 486 | err, head_config) : |
487 | add_tracepoint(list, idx, sys_name, evt_name, | 487 | add_tracepoint(list, idx, sys_name, evt_name, |
488 | error, head_config); | 488 | err, head_config); |
489 | } | 489 | } |
490 | 490 | ||
491 | static int add_tracepoint_multi_sys(struct list_head *list, int *idx, | 491 | static int add_tracepoint_multi_sys(struct list_head *list, int *idx, |
492 | char *sys_name, char *evt_name, | 492 | char *sys_name, char *evt_name, |
493 | struct parse_events_error *error, | 493 | struct parse_events_error *err, |
494 | struct list_head *head_config) | 494 | struct list_head *head_config) |
495 | { | 495 | { |
496 | struct dirent *events_ent; | 496 | struct dirent *events_ent; |
@@ -499,7 +499,7 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx, | |||
499 | 499 | ||
500 | events_dir = opendir(tracing_events_path); | 500 | events_dir = opendir(tracing_events_path); |
501 | if (!events_dir) { | 501 | if (!events_dir) { |
502 | tracepoint_error(error, errno, sys_name, evt_name); | 502 | tracepoint_error(err, errno, sys_name, evt_name); |
503 | return -1; | 503 | return -1; |
504 | } | 504 | } |
505 | 505 | ||
@@ -515,7 +515,7 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx, | |||
515 | continue; | 515 | continue; |
516 | 516 | ||
517 | ret = add_tracepoint_event(list, idx, events_ent->d_name, | 517 | ret = add_tracepoint_event(list, idx, events_ent->d_name, |
518 | evt_name, error, head_config); | 518 | evt_name, err, head_config); |
519 | } | 519 | } |
520 | 520 | ||
521 | closedir(events_dir); | 521 | closedir(events_dir); |
@@ -767,23 +767,23 @@ do { \ | |||
767 | 767 | ||
768 | int parse_events_add_tracepoint(struct list_head *list, int *idx, | 768 | int parse_events_add_tracepoint(struct list_head *list, int *idx, |
769 | char *sys, char *event, | 769 | char *sys, char *event, |
770 | struct parse_events_error *error, | 770 | struct parse_events_error *err, |
771 | struct list_head *head_config) | 771 | struct list_head *head_config) |
772 | { | 772 | { |
773 | if (head_config) { | 773 | if (head_config) { |
774 | struct perf_event_attr attr; | 774 | struct perf_event_attr attr; |
775 | 775 | ||
776 | if (config_attr(&attr, head_config, error, | 776 | if (config_attr(&attr, head_config, err, |
777 | config_term_tracepoint)) | 777 | config_term_tracepoint)) |
778 | return -EINVAL; | 778 | return -EINVAL; |
779 | } | 779 | } |
780 | 780 | ||
781 | if (strpbrk(sys, "*?")) | 781 | if (strpbrk(sys, "*?")) |
782 | return add_tracepoint_multi_sys(list, idx, sys, event, | 782 | return add_tracepoint_multi_sys(list, idx, sys, event, |
783 | error, head_config); | 783 | err, head_config); |
784 | else | 784 | else |
785 | return add_tracepoint_event(list, idx, sys, event, | 785 | return add_tracepoint_event(list, idx, sys, event, |
786 | error, head_config); | 786 | err, head_config); |
787 | } | 787 | } |
788 | 788 | ||
789 | int parse_events_add_numeric(struct parse_events_evlist *data, | 789 | int parse_events_add_numeric(struct parse_events_evlist *data, |