perf tools: Fix function declarations needed by parse-events.y
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 19 May 2015 13:05:42 +0000 (16:05 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 27 May 2015 15:21:43 +0000 (12:21 -0300)
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>
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h

index 80a50fdb6d8adc0bef80d10813c5534e8f9d761d..78032d887c1ae5e0b5debe0ead2a210fffcb5c7f 100644 (file)
 extern int parse_events_debug;
 #endif
 int parse_events_parse(void *data, void *scanner);
-int parse_events_term__num(struct parse_events_term **term,
-                          int type_term, char *config, u64 num,
-                          YYLTYPE *loc_term, YYLTYPE *loc_val);
-int parse_events_term__str(struct parse_events_term **term,
-                          int type_term, char *config, char *str,
-                          YYLTYPE *loc_term, YYLTYPE *loc_val);
 
 static struct perf_pmu_event_symbol *perf_pmu_events_list;
 /*
@@ -1601,8 +1595,11 @@ static int new_term(struct parse_events_term **_term, int type_val,
 
 int parse_events_term__num(struct parse_events_term **term,
                           int type_term, char *config, u64 num,
-                          YYLTYPE *loc_term, YYLTYPE *loc_val)
+                          void *loc_term_, void *loc_val_)
 {
+       YYLTYPE *loc_term = loc_term_;
+       YYLTYPE *loc_val = loc_val_;
+
        return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term,
                        config, NULL, num,
                        loc_term ? loc_term->first_column : 0,
@@ -1611,8 +1608,11 @@ int parse_events_term__num(struct parse_events_term **term,
 
 int parse_events_term__str(struct parse_events_term **term,
                           int type_term, char *config, char *str,
-                          YYLTYPE *loc_term, YYLTYPE *loc_val)
+                          void *loc_term_, void *loc_val_)
 {
+       YYLTYPE *loc_term = loc_term_;
+       YYLTYPE *loc_val = loc_val_;
+
        return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term,
                        config, str, 0,
                        loc_term ? loc_term->first_column : 0,
index e236f1b6ac6f165c92570e73bf8f2e28ad1f2197..131f29b2f13258d647276820026207526a08ef02 100644 (file)
@@ -98,6 +98,12 @@ struct parse_events_terms {
 };
 
 int parse_events__is_hardcoded_term(struct parse_events_term *term);
+int parse_events_term__num(struct parse_events_term **term,
+                          int type_term, char *config, u64 num,
+                          void *loc_term, void *loc_val);
+int parse_events_term__str(struct parse_events_term **term,
+                          int type_term, char *config, char *str,
+                          void *loc_term, void *loc_val);
 int parse_events_term__sym_hw(struct parse_events_term **term,
                              char *config, unsigned idx);
 int parse_events_term__clone(struct parse_events_term **new,