File: cppcheck.sh

package info (click to toggle)
efibootguard 0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 796 kB
  • sloc: ansic: 7,805; makefile: 405; python: 326; sh: 84
file content (74 lines) | stat: -rwxr-xr-x 2,744 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
#
# EFI Boot Guard
#
# Copyright (c) Siemens AG, 2021-2023
#
# Authors:
#  Claudius Heine <ch@denx.de>
#  Jan Kiszka <jan.kiszka@siemens.com>
#
# This work is licensed under the terms of the GNU GPL, version 2.  See
# the COPYING file in the top-level directory.
#
# SPDX-License-Identifier:      GPL-2.0-only
#

ignore=""
ignore+=" -i tests/fff"

suppress=""
# Justified suppressions:
# Does not belong to the project
suppress+=" --suppress=*:/usr/include/*"
suppress+=" --suppress=*:/usr/include/bits/*"
# Function 'efi_main' is called by efi:
suppress+=" --suppress=unusedFunction:main.c"
suppress+=" --suppress=unusedFunction:kernel-stub/main.c"
# Some functions are defined for API only
suppress+=" --suppress=unusedFunction:utils.c"
suppress+=" --suppress=unusedFunction:env/env_api.c"
suppress+=" --suppress=unusedFunction:env/fatvars.c"
suppress+=" --suppress=unusedFunction:tools/tests/fake_devices.c"
suppress+=" --suppress=unusedFunction:tools/tests/test_environment.c"
suppress+=" --suppress=unusedFunction:env/env_api_fat.c"
# Some functions are used by linker wrapping
suppress+=" --suppress=unusedFunction:tools/tests/test_probe_config_file.c"
suppress+=" --suppress=unusedFunction:tools/tests/test_ebgenv_api.c"
# False positive on wdfuncs iteration
suppress+=" --suppress=comparePointers:main.c"
# False positive on constructors, first hit
suppress+=" --suppress=unusedFunction:drivers/watchdog/amdfch_wdt.c"
# False positive, noreturn is not recognized
suppress+=" --suppress=nullPointerRedundantCheck:kernel-stub/main.c"
# Avoid noise regarding Ignore* or otherwise unused fields
suppress+=" --suppress=unusedStructMember:kernel-stub/main.c"
suppress+=" --suppress=unusedStructMember:kernel-stub/fdt.c"
# Not applicable because of API requirements
suppress+=" --suppress=constParameterPointer:drivers/watchdog/ipc4x7e_wdt.c"
suppress+=" --suppress=constParameterPointer:drivers/watchdog/w83627hf_wdt.c"
# Not applicable because of API requirements
suppress+=" --suppress=constParameterCallback:kernel-stub/initrd.c"

enable="--enable=warning \
        --enable=style \
        --enable=performance \
        --enable=portability \
        --enable=unusedFunction"

includes="-I . \
          -I include \
          -I /usr/include \
          -I /usr/include/linux \
          -I /usr/include/efi \
          -I /usr/include/efi/x86_64 \
          -I /usr/include/x86_64-linux-gnu \
          -I /usr/lib/gcc/x86_64-linux-gnu/9/include"

cpp_conf="-U__WINT_TYPE__ -U__GNUC__"
path=${1-.}

# Exit code '1' is returned if arguments are not valid or if no input
# files are provided. Compare 'cppcheck --help'.
cppcheck -f -q --error-exitcode=2 $enable $suppress $ignore \
    $cpp_conf $includes $path "$@"