From 2f65757ba6a38d3d39b42359cda3e853e02c2a15 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 30 Jan 2020 11:52:10 -0500 Subject: [PATCH] Silence -Wnull-dereference warning in generated CTF parser code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Building Babeltrace on amd64 with -O3 on Ubuntnu 18.04 (gcc 7.4.0-1ubuntu1~18.04.1), I see: make[1]: Entering directory '/home/smarchi/build/babeltrace-opt/src/plugins/ctf/common/metadata' CC libctf_parser_la-lexer.lo /home/smarchi/src/babeltrace/src/plugins/ctf/common/metadata/lexer.c: In function ‘yyrestart’: /home/smarchi/src/babeltrace/src/plugins/ctf/common/metadata/lexer.c:1997:20: error: potential null pointer dereference [-Werror=null-dereference] b->yy_fill_buffer = 1; ~~~~~~~~~~~~~~~~~~^~~ This is code generated by flex, there's not much we can do, so silence the warning for the helper library that contains the lexer/parser. Change-Id: I6698a73f50e88cb75b94ca80deec0f3a9556c4bf Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/2895 Tested-by: jenkins Reviewed-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- src/plugins/ctf/common/metadata/Makefile.am | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/ctf/common/metadata/Makefile.am b/src/plugins/ctf/common/metadata/Makefile.am index efbd50b9..5a6e4dee 100644 --- a/src/plugins/ctf/common/metadata/Makefile.am +++ b/src/plugins/ctf/common/metadata/Makefile.am @@ -10,7 +10,12 @@ libctf_parser_la_SOURCES = lexer.l parser.y objstack.c # with bt_. libctf_parser_la_CPPFLAGS = $(AM_CPPFLAGS) \ -include $(srcdir)/scanner-symbols.h -libctf_parser_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-function + +# This library contains (mostly) generated code, silence some warnings that it +# produces. +libctf_parser_la_CFLAGS = $(AM_CFLAGS) \ + -Wno-unused-function \ + -Wno-null-dereference libctf_ast_la_SOURCES = \ visitor-generate-ir.c \ -- 2.34.1