Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Fix function declarations needed by parse-events.y

Patch "perf tools: Add location to pmu event terms" moved declarations
for parse_events_term__num() and parse_events_term__str() so that they
were no longer visible in parse-events.y. That can result in segfaults
as the arguments no longer need match the function prototype.

Move the declarations back, changing YYLTYPE pointers to
pointers-to-void because YYLTYPE is not generated until parse-events.y
is processed.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Link: http://lkml.kernel.org/r/1432040746-1755-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
bb78ce7d 128c32ed

+14 -8
+8 -8
tools/perf/util/parse-events.c
··· 25 25 extern int parse_events_debug; 26 26 #endif 27 27 int parse_events_parse(void *data, void *scanner); 28 - int parse_events_term__num(struct parse_events_term **term, 29 - int type_term, char *config, u64 num, 30 - YYLTYPE *loc_term, YYLTYPE *loc_val); 31 - int parse_events_term__str(struct parse_events_term **term, 32 - int type_term, char *config, char *str, 33 - YYLTYPE *loc_term, YYLTYPE *loc_val); 34 28 35 29 static struct perf_pmu_event_symbol *perf_pmu_events_list; 36 30 /* ··· 1595 1601 1596 1602 int parse_events_term__num(struct parse_events_term **term, 1597 1603 int type_term, char *config, u64 num, 1598 - YYLTYPE *loc_term, YYLTYPE *loc_val) 1604 + void *loc_term_, void *loc_val_) 1599 1605 { 1606 + YYLTYPE *loc_term = loc_term_; 1607 + YYLTYPE *loc_val = loc_val_; 1608 + 1600 1609 return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term, 1601 1610 config, NULL, num, 1602 1611 loc_term ? loc_term->first_column : 0, ··· 1608 1611 1609 1612 int parse_events_term__str(struct parse_events_term **term, 1610 1613 int type_term, char *config, char *str, 1611 - YYLTYPE *loc_term, YYLTYPE *loc_val) 1614 + void *loc_term_, void *loc_val_) 1612 1615 { 1616 + YYLTYPE *loc_term = loc_term_; 1617 + YYLTYPE *loc_val = loc_val_; 1618 + 1613 1619 return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term, 1614 1620 config, str, 0, 1615 1621 loc_term ? loc_term->first_column : 0,
+6
tools/perf/util/parse-events.h
··· 98 98 }; 99 99 100 100 int parse_events__is_hardcoded_term(struct parse_events_term *term); 101 + int parse_events_term__num(struct parse_events_term **term, 102 + int type_term, char *config, u64 num, 103 + void *loc_term, void *loc_val); 104 + int parse_events_term__str(struct parse_events_term **term, 105 + int type_term, char *config, char *str, 106 + void *loc_term, void *loc_val); 101 107 int parse_events_term__sym_hw(struct parse_events_term **term, 102 108 char *config, unsigned idx); 103 109 int parse_events_term__clone(struct parse_events_term **new,