From a205225b4e48e464be5adc2545e2cd18c8221958 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 25 Dec 2020 09:05:05 +0100 Subject: [PATCH] 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] --- build_tools/lint.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/lint.fish b/build_tools/lint.fish index c5b3c824e..5a9e6edb6 100755 --- a/build_tools/lint.fish +++ b/build_tools/lint.fish @@ -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