lint.fish: properly handle -I and -D args for cppcheck

lint.fish receives arguments that contain multiple includes and defines.
As a result, we passed arguments like
"-I/usr/include -I$HOME/fish-shell/build -I/usr/include"
to cppcheck which interprets this as a single include directory.
This leads to errors like this one (because the "build" dir was missing):

	src/common.h:4:0: information: Include file: "config.h" not found. [missingInclude]
This commit is contained in:
Johannes Altmanninger 2020-12-25 09:05:05 +01:00
parent f0f5724e18
commit a205225b4e

View File

@ -18,11 +18,11 @@ argparse a/all p/project= -- $argv
# We only want -D and -I options to be passed thru to cppcheck.
for arg in $argv
if string match -q -- '-D*' $arg
set cppcheck_args $cppcheck_args $arg
set -a cppcheck_args (string split -- ' ' $arg)
else if string match -q -- '-I*' $arg
set cppcheck_args $cppcheck_args $arg
set -a cppcheck_args (string split -- ' ' $arg)
else if string match -q -- '-iquote*' $arg
set cppcheck_args $cppcheck_args $arg
set -a cppcheck_args (string split -- ' ' $arg)
end
end