From 9f2a20195dbdc0e69e1e33abb642242ec7c3e244 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 3 Feb 2023 13:59:23 -0500 Subject: [PATCH] Build fix: filter parser fails to build with -Werror MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Using bison 3.8.2 and clang 15.0.7, the project fails to build with -Werror as building the generated parser results in the following warning: CXX filter/libfilter_la-filter-parser.lo filter/filter-parser.cpp:1552:9: error: variable 'yynerrs' set but not used [-Werror,-Wunused-but-set-variable] int yynerrs = 0; ^ A pragma directive is inserted to silence the warning and allow the build to go through. Signed-off-by: Jérémie Galarneau Change-Id: I4c46a5df91bdeca6ad4e2a8ff7f2a98ee94c4f1d --- src/common/filter/filter-parser.ypp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/filter/filter-parser.ypp b/src/common/filter/filter-parser.ypp index 0f11c234d..fedf0e830 100644 --- a/src/common/filter/filter-parser.ypp +++ b/src/common/filter/filter-parser.ypp @@ -29,6 +29,14 @@ #define WIDTH_x64_SCANF_IS_A_BROKEN_API "17" #define WIDTH_lg_SCANF_IS_A_BROKEN_API "4096" /* Hugely optimistic approximation */ +/* + * bison 3.8.2 produces a parser with unused, but set, which results in warnings + * at build time. + */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-but-set-variable" +#endif /* __clang__ */ + #ifdef DEBUG static const int print_xml = 1; #define dbg_printf(fmt, args...) \ -- 2.34.1