Re: perf bison: clang points out: error: conflicting types for 'parse_events_error' always evaluate to 'true'

From: Jiri Olsa
Date: Wed Feb 15 2017 - 07:52:30 EST


On Wed, Feb 15, 2017 at 09:41:02AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Feb 15, 2017 at 11:50:56AM +0100, Jiri Olsa escreveu:
> > On Tue, Feb 14, 2017 at 03:24:35PM -0300, Arnaldo Carvalho de Melo wrote:
> > > util/pmu.c:948:28: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
> > > if ((info->unit && alias->unit) ||
> > > ~~ ~~~~~~~^~~~
> > > util/pmu.c:953:13: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
> > > if (alias->unit)
> > > ~~ ~~~~~~~^~~~
> > > 2 errors generated.
> > >
> > >
> > > So, is this test about having something on that alias->unit array? I.e.
> > > should this suffice?
> >
> > yep, that seems right.. good catch
>
> Thanks, adding your Acked-by then, ok?

yes

>
> How about this other one:
>
> CC /tmp/build/perf/util/trace-event-info.o
> util/parse-events.y:699:6: error: conflicting types for 'parse_events_error'
> void parse_events_error(YYLTYPE *loc, void *data,
> ^
> /tmp/build/perf/util/parse-events-bison.c:2224:7: note: previous implicit declaration is here
> yyerror (&yylloc, _data, scanner, YY_("syntax error"));
> ^
> /tmp/build/perf/util/parse-events-bison.c:65:25: note: expanded from macro 'yyerror'
> #define yyerror parse_events_error
> ^
> 1 error generated.
>

hum, thats generated code.. I guess we need appropriate -Wno-... option ;-)

jirka