Re: [PATCH v5 10/10] perf tools: report initial event parsing error

Jiri Olsa
2019-11-06T14:24:48Z

On Wed, Oct 30, 2019 at 03:34:48PM -0700, Ian Rogers wrote:

SNIP

> +
> +void parse_events_print_error(struct parse_events_error *err,
> + const char *event)
> +{
> + if (!err->num_errors)
> + return;
> +
> + __parse_events_print_error(err->idx, err->str, err->help, event);
> + zfree(&err->str);
> + zfree(&err->help);
> +
> + if (err->num_errors > 1) {
> + fputs("\nInitial error:\n", stderr);
> + __parse_events_print_error(err->first_idx, err->first_str,
> + err->first_help, event);
> + zfree(&err->first_str);
> + zfree(&err->first_help);
> }
> }
>
> @@ -2071,7 +2104,9 @@ int parse_events_option(const struct option *opt, const char *str,
> int unset __maybe_unused)
> {
> struct evlist *evlist = *(struct evlist **)opt->value;
> - struct parse_events_error err = { .idx = 0, };
> + struct parse_events_error err;
> +
> + bzero(&err, sizeof(err));
> int ret = parse_events(evlist, str, &err);

this breaks compilation:

make[3]: Nothing to be done for 'plugins/libtraceevent-dynamic-list'.
util/parse-events.c: In function ‘parse_events_option’:
util/parse-events.c:2110:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
2110 | int ret = parse_events(evlist, str, &err);
| ^~~

thanks,
jirka