Skip to content

Commit

Permalink
Silence -Wnull-dereference warning in generated CTF parser code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
simark authored and jgalar committed Feb 3, 2020
1 parent 04ab8e4 commit 2f65757
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/ctf/common/metadata/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 2f65757

Please sign in to comment.