On 2017-09-27 09:29, Jan Kiszka wrote:
> On 2017-09-26 15:22, [ext] [email protected] wrote:
>> From: Claudius Heine <[email protected]>
>>
>> This commit adds cppcheck as a travis target. Raised issues are
>> suppressed and should be fixed in further commits.
>>
>> Signed-off-by: Claudius Heine <[email protected]>
>> ---
>>  .travis-build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
>>  .travis.yml      |  1 +
>>  2 files changed, 44 insertions(+)
>>
>> diff --git a/.travis-build.sh b/.travis-build.sh
>> index 56786ab..c1d16cd 100755
>> --- a/.travis-build.sh
>> +++ b/.travis-build.sh
>> @@ -10,6 +10,21 @@ prepare_build()
>>      mkdir build
>>      cd build
>>  }
>> +
>> +install_cppcheck()
>> +{
>> +    git clone https://github.com/danmar/cppcheck.git
>> +    cd cppcheck
>> +    git checkout 1.80
>> +    make SRCDIR=build CFGDIR=/usr/share/cppcheck HAVE_RULES=no -j2
>> +    sudo make install
>> +    # On travis cppcheck ignores CFGDIR. Instead, it looks in $PWD. Compare
>> +    # strace output.
>> +    sudo install -m644 ./cfg/* ../
>> +    cd ..
>> +    rm -rf cppcheck
>> +}
>> +
> 
> Is anything that trusty (1.61 / 1.66) or xenial (1.72) provides in terms
> of cppcheck too old? If yes, the build should not flood the logs with
> tons of warnings like it does right now (not a good sign for this
> cppversion version...).
> 
>>  case "$TARGET" in
>>      native)
>>          prepare_build
>> @@ -24,6 +39,34 @@ case "$TARGET" in
>>              host_alias=i586-linux
>>          exec make check
>>          ;;
>> +    cppcheck)
>> +        install_cppcheck
>> +        sup_error=""
>> +        sup_warn="--suppress=invalidScanfArgType_int:tools/ebgpart.c"
>> +        sup_info=""
>> +        sup_perf="--suppress=invalidscanf:tools/ebgpart.c"
>> +        sup_style="\
>> +            --suppress=unusedFunction:tools/bg_utils.c \
>> +            --suppress=unusedFunction:utils \
>> +            --suppress=unusedFunction:swupdate-adapter/ebgenv.c \
>> +            --suppress=unusedFunction:main.c \
>> +            --suppress=unusedFunction:tools/tests/test_environment.c \
>> +            --suppress=unusedFunction:env/fatvars.c"
>> +        suppress="$sup_error $sup_warn $sup_info $sup_perf $sup_style"
>> +        enable="--enable=all --check-config"
>> +        includes="-I include \
>> +                  -I tools \
>> +                  -I swupdate-adapter \
>> +                  -I /usr/include \
>> +                  -I /usr/include/linux \
>> +                  -I /usr/include/efi \
>> +                  -I /usr/include/efi/x86_64 \
>> +                  -I /usr/include/x86_64-linux-gnu"
>> +        # Exit code '1' is returned if arguments are not valid or if no 
>> input
>> +        # files are provided. Compare 'cppcheck --help'.
>> +        exec cppcheck -f -q --error-exitcode=2 --std=posix \
>> +            $enable $suppress $includes .
>> +        ;;
>>      *)
>>          exit -1
>>          ;;
>> diff --git a/.travis.yml b/.travis.yml
>> index dae0337..4fa4045 100644
>> --- a/.travis.yml
>> +++ b/.travis.yml
>> @@ -14,6 +14,7 @@ env:
>>    matrix:
>>      - TARGET=native
>>      - TARGET=i586
>> +    - TARGET=cppcheck
>>  language: c
>>  
>>  compiler:
>>
> 
> Jan
> 

Looking at the (presumably) relevant output of the cppcheck run,

(information) Couldn't find path given by -I 'swupdate-adapter/'
[/usr/include/libio.h:49]: (information) Include file: <stdarg.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[/usr/include/stdio.h:83]: (information) Include file: <stdarg.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[include/env_api.h:20]: (information) Include file: <stdbool.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[/usr/include/wchar.h:39]: (information) Include file: <stdarg.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[include/env_api.h:29]: (information) Include file: "config.h" not found.
[/usr/include/x86_64-linux-gnu/zconf.h:427]: (information) Include file: 
<stdarg.h> not found. Please note: Cppcheck does not need standard library 
headers to get proper results.
[/usr/include/bits/stdio-lock.h:23]: (information) Include file: 
<lowlevellock.h> not found. Please note: Cppcheck does not need standard 
library headers to get proper results.
[include/ebgpart.h:43]: (information) Include file: <stdbool.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[/usr/include/wchar.h:88]: (information) Skipping configuration 
'_GLIBCPP_USE_NAMESPACES;__WINT_TYPE__;_WINT_T;__WINT_TYPE__' since the value 
of '__WINT_TYPE__' is unknown. Use -D if you want to check it. You can use -U 
to skip it explicitly.
[/usr/include/wchar.h:88]: (information) Skipping configuration 
'_WINT_T;__WINT_TYPE__' since the value of '__WINT_TYPE__' is unknown. Use -D 
if you want to check it. You can use -U to skip it explicitly.
[/usr/include/wchar.h:88]: (information) Skipping configuration '__WINT_TYPE__' 
since the value of '__WINT_TYPE__' is unknown. Use -D if you want to check it. 
You can use -U to skip it explicitly.
[tools/tests/test_api.c:14]: (information) Include file: <stdarg.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[tools/tests/test_api.c:16]: (information) Include file: <stdbool.h> not found. 
Please note: Cppcheck does not need standard library headers to get proper 
results.
[tools/tests/test_environment.c:14]: (information) Include file: <stdarg.h> not 
found. Please note: Cppcheck does not need standard library headers to get 
proper results.
[tools/tests/test_environment.c:16]: (information) Include file: <stdbool.h> 
not found. Please note: Cppcheck does not need standard library headers to get 
proper results.
[tools/tests/test_partitions.c:14]: (information) Include file: <stdarg.h> not 
found. Please note: Cppcheck does not need standard library headers to get 
proper results.
[tools/tests/test_partitions.c:16]: (information) Include file: <stdbool.h> not 
found. Please note: Cppcheck does not need standard library headers to get 
proper results.

it seems there is still some work needed to fine tune the setting prior
to activating this.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/7d487aae-fd74-4b47-6f22-ae8c51f5541f%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to