Put bison/flex files in parsers dir, so scan-build --exclude can be used

The autogenerated files create warnings that we can't do much about, so
exclude them.
This commit is contained in:
ejurgensen 2022-01-11 18:54:47 +01:00
parent 397800c9cd
commit f36d1cce6d
11 changed files with 15 additions and 17 deletions

View File

@ -43,7 +43,7 @@ jobs:
sudo apt-get install -yq build-essential clang clang-tools git autotools-dev autoconf libtool gettext gawk gperf bison flex libconfuse-dev libunistring-dev libsqlite3-dev libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev libevent-dev libplist-dev libsodium-dev libcurl4-openssl-dev libjson-c-dev libprotobuf-c-dev libpulse-dev libwebsockets-dev libgnutls28-dev
autoreconf -vi
./configure --enable-lastfm --enable-chromecast
scan-build --status-bugs -disable-checker deadcode.DeadStores make
scan-build --status-bugs -disable-checker deadcode.DeadStores --exclude src/parsers make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -32,11 +32,11 @@ If you modify any .gperf files, you will need to install it.]])],
])
AX_PROG_FLEX([AC_DEFINE([LEX], [flex], [flex found])],
[AS_IF([test ! -f "$srcdir/src/smartpl_lexer.c"],
[AS_IF([test ! -f "$srcdir/src/parsers/smartpl_lexer.c"],
[AC_MSG_ERROR([flex required, please install it])])
])
AX_PROG_BISON([AC_DEFINE([YACC], [bison], [GNU bison found])],
[AS_IF([test ! -f "$srcdir/src/smartpl_parser.c"],
[AS_IF([test ! -f "$srcdir/src/parsers/smartpl_parser.c"],
[AC_MSG_ERROR([GNU bison required, please install it])])
])

3
src/.gitignore vendored
View File

@ -1,8 +1,5 @@
owntone
*_lexer.[ch]
*_parser.[ch]
daap_query_hash.h
rsp_query_hash.h
dacp_prop_hash.h

View File

@ -62,14 +62,8 @@ GPERF_FILES = \
GPERF_SRC = $(GPERF_FILES:.gperf=_hash.h)
LEXER_SRC = daap_lexer.l smartpl_lexer.l
PARSER_SRC = daap_parser.y smartpl_parser.y
# This flag is given to flex and tells it to produce headers. automake's ylwrap
# doesn't seem to rename the header like it does with the .c flex output, so
# here we give it the final name. The "$(@:.c=.h)" uses substitution reference
# and means 'change .c to .h in $@' (the target name, e.g. calc_lexer.c).
AM_LFLAGS = --header-file=$(@:.c=.h)
LEXER_SRC = parsers/daap_lexer.l parsers/smartpl_lexer.l
PARSER_SRC = parsers/daap_parser.y parsers/smartpl_parser.y
# This flag is given to Bison and tells it to produce headers. Note that
# automake recognizes this flag too, and has special logic around it, so don't
@ -153,7 +147,7 @@ owntone_SOURCES = main.c \
# the C files as target, as the AM_LFLAGS will make sure headers are produced.
BUILT_SOURCES = \
$(GPERF_SRC) \
$(LEXER_SRC:.l=.c) $(PARSER_SRC:.y=.h)
$(LEXER_SRC:.l=.h) $(PARSER_SRC:.y=.h)
# automake doesn't know how to make lexer headers, nor does it automatically
# include them, so need to specify them as EXTRA_DIST.
@ -165,6 +159,11 @@ EXTRA_DIST = \
%_hash.h: %.gperf
$(AM_V_GEN)$(GPERF) --output-file=$@ $<
# Rule for generating lexer headers. $@ is an automatic variable that is equal
# to the particular target name, so a header file name.
$(LEXER_SRC:.l=.h): $(LEXER_SRC)
$(LEX) --header-file=$@ --stdout $(@:.h=.l) > /dev/null
# Anything built by make should be cleaned by make clean, but when it comes to
# flex/bison automake's support leaves something to be desired
clean-local:

View File

@ -26,7 +26,7 @@
#include <errno.h>
#include "daap_query.h"
#include "daap_parser.h"
#include "parsers/daap_parser.h"
#include "logger.h"
#include "misc.h"

2
src/parsers/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*_lexer.[ch]
*_parser.[ch]

View File

@ -32,7 +32,7 @@
#include <errno.h>
#include "smartpl_query.h"
#include "smartpl_parser.h"
#include "parsers/smartpl_parser.h"
#include "logger.h"
#include "misc.h"