perf parse-events: Disable a subset of bison warnings
authorIan Rogers <irogers@google.com>
Fri, 19 Jun 2020 04:33:56 +0000 (21:33 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 2 Jul 2020 11:35:38 +0000 (08:35 -0300)
commit1f16fcad688552d442ddf1c5d3d8d4152d9bf4af
treec8513cec8eb33067ab913810370d03fa7f0a91f0
parent304d7a90c43f7471fb481e6b1e2b47fef2a02b8c
perf parse-events: Disable a subset of bison warnings

Rather than disable all warnings with -w, disable specific warnings.

Predicate enabling the warnings on a recent version of bison.

Tested with GCC 9.3.0 and clang 9.0.1.

Committer testing:

The full set of compilers, gcc and clang that this will be tested on
will be on the signed tag when this change goes upstream.

Had to add -Wno-switch-enum to build on opensuse tumbleweed:

  /tmp/build/perf/util/parse-events-bison.c: In function 'yydestruct':
  /tmp/build/perf/util/parse-events-bison.c:1200:3: error: enumeration value 'YYSYMBOL_YYEMPTY' not handled in switch [-Werror=switch-enum]
   1200 |   switch (yykind)
        |   ^~~~~~
  /tmp/build/perf/util/parse-events-bison.c:1200:3: error: enumeration value 'YYSYMBOL_YYEOF' not handled in switch [-Werror=switch-enum]

Also replace -Wno-error=implicit-function-declaration with -Wno-implicit-function-declaration.

Also needed to check just the first two levels of the bison version, as
the patch was assuming that all versions were of the form x.y.z, and
there are several cases where it is just x.y, breaking the build.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200619043356.90024-11-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/Build