Silence -Wnull-dereference warning in generated CTF parser code
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Jan 2020 16:52:10 +0000 (11:52 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 3 Feb 2020 19:45:40 +0000 (14:45 -0500)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2895
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/plugins/ctf/common/metadata/Makefile.am

index efbd50b91d9a32fae5a6f5d1776dde9afe67c15f..5a6e4deec75c021966ebcc67931c2194ee9a1dae 100644 (file)
@@ -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 \
This page took 0.024629 seconds and 4 git commands to generate.