From: Simon Marchi Date: Thu, 30 Jan 2020 16:52:10 +0000 (-0500) Subject: Silence -Wnull-dereference warning in generated CTF parser code X-Git-Tag: v2.0.1~7 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=2f65757ba6a38d3d39b42359cda3e853e02c2a15 Silence -Wnull-dereference warning in generated CTF parser code 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 --- 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 \