From cc64c961ffb313f04d2e1088bc37134fb2c57e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Thu, 21 Sep 2023 12:32:49 +0200 Subject: [PATCH 01/11] [gcc] Add support for the GCC Static Analyzer --- .github/workflows/install-deps.sh | 5 +- .github/workflows/pypi.yml | 4 +- analyzer/.coverage | Bin 0 -> 110592 bytes .../analyzers/analyzer_types.py | 4 +- .../analyzers/gcc/__init__.py | 7 + .../analyzers/gcc/analyzer.py | 274 +++++++++++++++++ .../analyzers/gcc/config_handler.py | 18 ++ .../analyzers/gcc/result_handler.py | 88 ++++++ .../codechecker_analyzer/cmd/analyzers.py | 2 + analyzer/codechecker_analyzer/cmd/checkers.py | 4 + .../tests/functional/analyze/test_analyze.py | 2 +- .../test_analyze_and_parse.py | 4 +- .../analyze_and_parse/test_files/Makefile | 2 + .../test_files/gcc_simple.cpp | 6 + .../test_files/gcc_simple.output | 57 ++++ config/labels/analyzers/gcc.json | 285 ++++++++++++++++++ config/package_layout.json | 3 +- docs/README.md | 7 +- .../checker_and_analyzer_configuration.md | 4 + docs/analyzer/user_guide.md | 12 +- 20 files changed, 773 insertions(+), 15 deletions(-) create mode 100644 analyzer/.coverage create mode 100644 analyzer/codechecker_analyzer/analyzers/gcc/__init__.py create mode 100644 analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py create mode 100644 analyzer/codechecker_analyzer/analyzers/gcc/config_handler.py create mode 100644 analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py create mode 100644 analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.cpp create mode 100644 analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output create mode 100644 config/labels/analyzers/gcc.json diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index c9d37e56c9..37bf443384 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -2,11 +2,13 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' -y +# Required for g++-13, as the latest LTS at the time of this change hasn't made it available. +sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -q sudo apt-get install \ - g++-9 \ + g++-13 \ gcc-multilib \ libc6-dev-i386 \ libpq-dev \ @@ -20,3 +22,4 @@ sudo apt-get install \ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 9999 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 9999 sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 9999 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 9999 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 70b5129feb..26836213a0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -73,12 +73,12 @@ jobs: - name: "Install run-time dependencies (Linux)" if: ${{ matrix.os == 'ubuntu-20.04' }} run: - sudo apt-get update && sudo apt-get install g++ clang clang-tidy cppcheck + sudo apt-get update && sudo apt-get install g++-13 clang clang-tidy cppcheck - name: "Install run-time dependencies (OSX)" if: ${{ matrix.os == 'macos-10.15' }} run: - brew install llvm cppcheck + brew install llvm cppcheck g++-13 - name: "Install run-time dependencies (Windows)" if: ${{ matrix.os == 'windows-2019' }} diff --git a/analyzer/.coverage b/analyzer/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..80261d58ae0c6c65656b6059d4eb7759f5d718b6 GIT binary patch literal 110592 zcmeHw31Aat+W#|?$(>9>TWC3(Lgl6@cR8DuLoT^bInp#u+t4%#Nm^R2W&jmM7sLZu z5zuu#QCMA9yl6y4Ki3uAZx>WliuZ~_LFBN|{GWFwX;Y5ffSLXF`~EY~JnziB^ZwrF z_ulu6X_K4*hpE`(E4Kwq{lN$n1s0PD05tg59{-}35)DlB1|=0^zM4@3S#u`n4YNU~ zxE~CQ^m7e;bidb|wV&uJ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zCE~-!V3y%3jySidi}LlahBtYN`6JncEzo1i+%jAxA{v^|*%E{1;8chf*FfO4>lXcj z3E!m1dTzQj3sBI>(;6;>@nC^{fL8JEz+S?mZde91wH0f_;L0f~YC-3;KYki59gs*SI! z)`cgR#CFueZX8Y;lR$uIU$EEj_4u7tSSZ5pM1ycS-4#5OtE7$*Lt_*kKsX ze#BO=t@Y1g>;G%rT5SD?w9_@;Yi`5V{|oAIs>5hax+Df91|$X~1|$X~1|$Zqoq+_m z_nMXrl=wUqUbD5iw%;kiGh8o4D)#uwZGnJr)>yj8U`^npUEVRlEwU!ZBOKz9eEcDq z9YhYR<_dND1lM$&0UqaOz*I371?aM>dC86pKo%o)G=B0aYT>w$OqNnHe6ibEX zBfQ5axa+b>g_tAZCyR*@ITHRRv4SFUC!tz!*Qo3@b0@dL#I}cnF9(^sm+fG^u*oEZ4;xId5DXu*+6%6mdNfEUwML zu359_2V_129&RNTOiVc0@Z_vGHzA99?q7vd)Lv7c31`4_w_x=(CNPi3gpQrqOPbuW+A0s z1+mBxU5s!Q3r${%VZRCw9E)>VTS9yh13iz+MCe3qOX+v|amtn3R^sp>y9Ic%nJDYI zo9FNqaGk}1h|b}&;u&LcZhstKxf7j<*ffXF%9%t%5a#fa@&6P&TNUU34`u((`q>oy zPJO=aBb`r|qjka3u;XF;GZJZ(~Hm?&^87|TgssMrjIU)_&35zB8Hi1Q? z04IBCyPSonL|d_xu;Jiop_9a^2_iw@i4E8&;3pWgTf}g=B1|xFd;Fx~J5i(&N4KYl z_kM4YQXMvD${f`g*nIz5u1G`vJ;`eHKm2A4b{#3Yd* zN=%O9qwC7F5wpq1^90be=CC! J1St#X{vTY}>U;nI literal 0 HcmV?d00001 diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py index b1400b2258..943a11ee27 100644 --- a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py +++ b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py @@ -24,12 +24,14 @@ from .clangtidy.analyzer import ClangTidy from .clangsa.analyzer import ClangSA from .cppcheck.analyzer import Cppcheck +from .gcc.analyzer import Gcc LOG = get_logger('analyzer') supported_analyzers = {ClangSA.ANALYZER_NAME: ClangSA, ClangTidy.ANALYZER_NAME: ClangTidy, - Cppcheck.ANALYZER_NAME: Cppcheck} + Cppcheck.ANALYZER_NAME: Cppcheck, + Gcc.ANALYZER_NAME: Gcc} def is_ctu_capable(): diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/__init__.py b/analyzer/codechecker_analyzer/analyzers/gcc/__init__.py new file mode 100644 index 0000000000..4259749345 --- /dev/null +++ b/analyzer/codechecker_analyzer/analyzers/gcc/__init__.py @@ -0,0 +1,7 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py new file mode 100644 index 0000000000..27d181c4e9 --- /dev/null +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -0,0 +1,274 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- +""" +""" +from collections import defaultdict +# TODO distutils will be removed in python3.12 +from distutils.version import StrictVersion +import os +import pickle +import shlex +import subprocess + +from codechecker_common.logger import get_logger + +from codechecker_analyzer import analyzer_context + +from .. import analyzer_base +from ..flag import has_flag + +from .config_handler import GccConfigHandler +from .result_handler import GccResultHandler + +LOG = get_logger('analyzer.gcc') + + +class Gcc(analyzer_base.SourceAnalyzer): + """ + Constructs the Gcc analyzer commands. + """ + + ANALYZER_NAME = 'gcc' + + @classmethod + def analyzer_binary(cls): + return analyzer_context.get_context() \ + .analyzer_binaries[cls.ANALYZER_NAME] + + @classmethod + def get_version(cls, env=None): + """ Get analyzer version information. """ + return cls.__get_analyzer_version(cls.analyzer_binary(), env) + + def add_checker_config(self, checker_cfg): + LOG.error("Checker configuration for Gcc is not implemented yet") + + def get_analyzer_mentioned_files(self, output): + """ + Return a collection of files that were mentioned by the analyzer in + its standard outputs, which should be analyzer_stdout or + analyzer_stderr from a result handler. + """ + pass + + def construct_analyzer_cmd(self, result_handler): + """ + Construct analyzer command for gcc. + """ + # TODO: This is not a try-catch block, like the other analyzers. Why + # should it? Should the others be? When can list creating list to have + # unforeseen exceptions where a general catch is justified? + config = self.config_handler + + # We don't want GCC do start linking, but -fsyntax-only stops the + # compilation process too early for proper diagnostics generation. + analyzer_cmd = [Gcc.analyzer_binary(), '-fanalyzer', '-c', + '-o/dev/null'] + + # Add extra arguments. + analyzer_cmd.extend(config.analyzer_extra_arguments) + + analyzer_cmd.extend(self.buildaction.analyzer_options) + + analyzer_cmd.append('-fdiagnostics-format=sarif-file') + + compile_lang = self.buildaction.lang + if not has_flag('-x', analyzer_cmd): + analyzer_cmd.extend(['-x', compile_lang]) + + analyzer_cmd.append(self.source_file) + + LOG.debug_analyzer("Running analysis command " + f"'{shlex.join(analyzer_cmd)}'") + + return analyzer_cmd + + @classmethod + def get_analyzer_checkers(cls): + """ + Return the list of the supported checkers. + """ + command = [cls.analyzer_binary(), "--help=warning"] + checker_list = [] + + try: + output = subprocess.check_output(command) + + # Still contains the help message we need to remove. + for entry in output.decode().split('\n'): + warning_name, _, description = entry.strip().partition(' ') + if warning_name.startswith('-Wanalyzer'): + checker_list.append((warning_name, description)) + return checker_list + except (subprocess.CalledProcessError) as e: + LOG.error(e.stderr) + except (OSError) as e: + LOG.error(e.errno) + return [] + + @classmethod + def get_analyzer_config(cls): + """ + Config options for gcc. + """ + # TODO + return [] + + @classmethod + def get_checker_config(cls): + """ + TODO add config options for gcc checkers. + """ + # TODO + return [] + + def analyze(self, analyzer_cmd, res_handler, proc_callback=None): + env = None + + original_env_file = os.environ.get( + 'CODECHECKER_ORIGINAL_BUILD_ENV') + if original_env_file: + with open(original_env_file, 'rb') as env_file: + env = pickle.load(env_file, encoding='utf-8') + + return super().analyze(analyzer_cmd, res_handler, proc_callback, env) + + def post_analyze(self, result_handler: GccResultHandler): + """ + Post process the reuslts after the analysis. + Will copy the sarif files created by gcc into the root of the reports + folder. + Renames the source plist files to *.plist.bak because + The report parsing of the Parse command is done recursively. + + """ + pass + + @classmethod + def resolve_missing_binary(cls, configured_binary, env): + """ + In case of the configured binary for the analyzer is not found in the + PATH, this method is used to find a callable binary. + """ + + LOG.error("%s not found in path for GCC!", configured_binary) + + # if os.path.isabs(configured_binary): + # # Do not autoresolve if the path is an absolute path as there + # # is nothing we could auto-resolve that way. + # return False + + # cppcheck = get_binary_in_path(['g++-13'], + # r'^cppcheck(-\d+(\.\d+){0,2})?$', + # env) + + # if cppcheck: + # LOG.debug("Using '%s' for Cppcheck!", cppcheck) + # return cppcheck + + @classmethod + def __get_analyzer_version(cls, analyzer_binary, env): + """ + Return the analyzer version. + """ + # --version outputs a lot of garbage as well (like copyright info), + # this only contains the version info. + version = [analyzer_binary, '-dumpfullversion'] + try: + output = subprocess.check_output(version, + env=env, + encoding="utf-8", + errors="ignore") + return output + except (subprocess.CalledProcessError, OSError) as oerr: + LOG.warning("Failed to get analyzer version: %s", + ' '.join(version)) + LOG.warning(oerr) + + return None + + @classmethod + def version_compatible(cls, configured_binary, environ): + """ + Check the version compatibility of the given analyzer binary. + """ + analyzer_version = \ + cls.__get_analyzer_version(configured_binary, environ) + + # The analyzer version should be above 13.0.0 because the + # '-fdiagnostics-format=sarif-file' argument was introduced in this + # release. + if analyzer_version >= StrictVersion("13.0.0"): + return True + + # FIXME: Maybe this isn't to place to emit an error, especially when + # we cycle over multiple binarier to find the correct one. + LOG.error("GCC binary found is too old at " + f"v{analyzer_version.strip()}; minimum version is 13.0.0.") + return False + + def construct_result_handler(self, buildaction, report_output, + skiplist_handler): + """ + See base class for docs. + """ + res_handler = GccResultHandler(buildaction, report_output, + self.config_handler.report_hash) + + res_handler.skiplist_handler = skiplist_handler + + return res_handler + + @classmethod + def construct_config_handler(cls, args): + context = analyzer_context.get_context() + handler = GccConfigHandler() + + analyzer_config = defaultdict(list) + + if 'analyzer_config' in args and \ + isinstance(args.analyzer_config, list): + for cfg in args.analyzer_config: + if cfg.analyzer == cls.ANALYZER_NAME: + analyzer_config[cfg.option].append(cfg.value) + + handler.analyzer_config = analyzer_config + + # check_env = context.analyzer_env + + # # Overwrite PATH to contain only the parent of the cppcheck binary. + # if os.path.isabs(Gcc.analyzer_binary()): + # check_env['PATH'] = os.path.dirname(Gcc.analyzer_binary()) + + checkers = cls.get_analyzer_checkers() + + # Cppcheck can and will report with checks that have a different + # name than marked in the --errorlist xml. To be able to suppress + # these reports, the checkerlist needs to be extended by those found + # in the label file. + checker_labels = context.checker_labels + checkers_from_label = checker_labels.checkers("gcc") + parsed_set = set([data[0] for data in checkers]) + for checker in set(checkers_from_label): + if checker not in parsed_set: + checkers.append((checker, "")) + + try: + cmdline_checkers = args.ordered_checkers + except AttributeError: + LOG.debug_analyzer('No checkers were defined in ' + 'the command line for %s', + cls.ANALYZER_NAME) + cmdline_checkers = [] + + handler.initialize_checkers( + checkers, + cmdline_checkers, + 'enable_all' in args and args.enable_all) + + return handler diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/config_handler.py b/analyzer/codechecker_analyzer/analyzers/gcc/config_handler.py new file mode 100644 index 0000000000..0e88e50ee6 --- /dev/null +++ b/analyzer/codechecker_analyzer/analyzers/gcc/config_handler.py @@ -0,0 +1,18 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- +""" +Config handler for Gcc analyzer. +""" +from .. import config_handler + + +class GccConfigHandler(config_handler.AnalyzerConfigHandler): + """ + Configuration handler for Gcc analyzer. + """ + pass diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py b/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py new file mode 100644 index 0000000000..6a02648bf6 --- /dev/null +++ b/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py @@ -0,0 +1,88 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- +""" +Result handler for Gcc. +""" +from typing import Optional +from pathlib import Path +import shutil +import os + +from codechecker_report_converter.report.parser.base import AnalyzerInfo +from codechecker_report_converter.analyzers.gcc.analyzer_result import \ + AnalyzerResult +from codechecker_report_converter.report import report_file +from codechecker_report_converter.report.hash import get_report_hash, HashType + +from codechecker_common.logger import get_logger +from codechecker_common.skiplist_handler import SkipListHandlers + +from ..result_handler_base import ResultHandler + +LOG = get_logger('analyzer.gcc') + + +class GccResultHandler(ResultHandler): + """ + Create analyzer result file for Gcc output. + """ + + def __init__(self, *args, **kwargs): + self.analyzer_info = AnalyzerInfo(name=AnalyzerResult.TOOL_NAME) + self.gcc_analyzer_result = AnalyzerResult() + + super(GccResultHandler, self).__init__(*args, **kwargs) + + def postprocess_result(self, skip_handlers: Optional[SkipListHandlers]): + """ + Generate analyzer result output file which can be parsed and stored + into the database. + """ + LOG.debug_analyzer(self.analyzer_stdout) + gcc_output_file = self.analyzed_source_file + ".sarif" + + # Gcc doesn't create any files when there are no diagnostics. + # Unfortunately, we can't tell whethet the file missing was because of + # that or some other error, we need to bail out here. + if not os.path.exists(gcc_output_file): + return + + reports = report_file.get_reports( + gcc_output_file, self.checker_labels, + source_dir_path=self.source_dir_path) + + reports = [r for r in reports if not r.skip(skip_handlers)] + # for report in reports: + # # TODO check if prefix cascading still occurs. + # if not report.checker_name.startswith("gcc-"): + # report.checker_name = "gcc-" + report.checker_name + + hash_type = HashType.PATH_SENSITIVE + if self.report_hash_type == 'context-free-v2': + hash_type = HashType.CONTEXT_FREE + elif self.report_hash_type == 'diagnostic-message': + hash_type = HashType.DIAGNOSTIC_MESSAGE + + for report in reports: + report.report_hash = get_report_hash(report, hash_type) + + report_file.create( + self.analyzer_result_file, reports, self.checker_labels, + self.analyzer_info) + + # TODO Maybe move this to post_analyze? + gcc_out_folder = Path(self.workspace, "gcc") + gcc_out_folder.mkdir(exist_ok=True) + gcc_dest_file_name = \ + Path(gcc_out_folder, os.path.basename(self.analyzed_source_file) + + self.buildaction_hash + ".sarif.bak") + try: + shutil.move(gcc_output_file, gcc_dest_file_name) + except(OSError) as e: + LOG.error(f"Failed to move '{gcc_output_file}' to " + f"'{gcc_out_folder}': {e}") diff --git a/analyzer/codechecker_analyzer/cmd/analyzers.py b/analyzer/codechecker_analyzer/cmd/analyzers.py index d66a190340..d599695895 100644 --- a/analyzer/codechecker_analyzer/cmd/analyzers.py +++ b/analyzer/codechecker_analyzer/cmd/analyzers.py @@ -145,6 +145,8 @@ def main(args): elif args.dump_config == 'cppcheck': # TODO: Not supported by CppCheck yet! LOG.warning("'--dump-config cppcheck' is not supported.") + elif args.dump_config == 'gcc': + raise NotImplementedError('--dump-config') return diff --git a/analyzer/codechecker_analyzer/cmd/checkers.py b/analyzer/codechecker_analyzer/cmd/checkers.py index 273ac632e3..e55032dc8d 100644 --- a/analyzer/codechecker_analyzer/cmd/checkers.py +++ b/analyzer/codechecker_analyzer/cmd/checkers.py @@ -545,6 +545,10 @@ def __print_checker_config(args: argparse.Namespace): if analyzer != "cppcheck": analyzer_failures.append(analyzer) continue + # TODO + if analyzer != "gcc": + analyzer_failures.append(analyzer) + continue rows.extend((':'.join((analyzer, c[0])), c[1]) if 'details' in args else (':'.join((analyzer, c[0])),) for c in configs) diff --git a/analyzer/tests/functional/analyze/test_analyze.py b/analyzer/tests/functional/analyze/test_analyze.py index 3cc6b53ede..39027cc447 100644 --- a/analyzer/tests/functional/analyze/test_analyze.py +++ b/analyzer/tests/functional/analyze/test_analyze.py @@ -1134,7 +1134,7 @@ def test_disable_all_checkers(self): out, _ = process.communicate() # Checkers of all 3 analyzers are disabled. - self.assertEqual(out.count("No checkers enabled for"), 3) + self.assertEqual(out.count("No checkers enabled for"), 4) def test_analyzer_and_checker_config(self): """Test analyzer configuration through command line flags.""" diff --git a/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py b/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py index 3ad7890b2b..98fabd73ce 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py +++ b/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py @@ -223,7 +223,8 @@ def check_one_file(self, path, mode): "[] - Enabled checkers:", "clang-tidy:", "clangsa:", - "cppcheck:"] + "cppcheck:", + "gcc:"] for line in output: # replace timestamps line = re.sub(r'\[\w+ \d{4}-\d{2}-\d{2} \d{2}:\d{2}\]', @@ -249,6 +250,7 @@ def check_one_file(self, path, mode): print(correct_output) print("Test output file: " + path) + self.maxDiff = None self.assertEqual(''.join(post_processed_output), correct_output) def test_json_output_for_macros(self): diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/Makefile b/analyzer/tests/functional/analyze_and_parse/test_files/Makefile index 49d037b5cb..0e214e6557 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/Makefile +++ b/analyzer/tests/functional/analyze_and_parse/test_files/Makefile @@ -49,3 +49,5 @@ cppcheck_include: $(CXX) -w cppcheck_include.cpp -I ./includes/ -o /dev/null cppcheck_undef_include: $(CXX) -w cppcheck_include.cpp -I./includes/ -U HAVE_NULL_DEREFERENCE -o /dev/null +gcc_simple: + $(CXX) -w gcc_simple.cpp -o /dev/null -c diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.cpp b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.cpp new file mode 100644 index 0000000000..cc1180eea1 --- /dev/null +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.cpp @@ -0,0 +1,6 @@ +#include +void g(void *i) { + i = malloc(sizeof(int)); + free(i); + free(i); +} diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output new file mode 100644 index 0000000000..d1eaa56193 --- /dev/null +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output @@ -0,0 +1,57 @@ +NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet +NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive +NORMAL#CodeChecker parse $OUTPUT$ +CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=sensitive +----------------------------------------------- +[] - Starting build... +[] - Using CodeChecker ld-logger. +[] - Build finished successfully. +[] - Starting static analysis ... +[] - [1/1] gcc analyzed gcc_simple.cpp successfully. +[] - ----==== Summary ====---- +[] - Successfully analyzed +[] - gcc: 1 +[] - Total analyzed compilation commands: 1 +[] - ----=================---- +[] - Analysis finished. +[] - To view results in the terminal use the "CodeChecker parse" command. +[] - To store results use the "CodeChecker store" command. +[] - See --help and the user guide for further options about parsing and storing the reports. +[] - ----=================---- +[LOW] gcc_simple.cpp:5:3: double-‘free’ of ‘i’ [-Wanalyzer-double-free] + free(i); + ^ + +Found 1 defect(s) in gcc_simple.cpp + + +----==== Severity Statistics ====---- +---------------------------- +Severity | Number of reports +---------------------------- +LOW | 1 +---------------------------- +----=================---- + +----==== Checker Statistics ====---- +----------------------------------------------------- +Checker name | Severity | Number of reports +----------------------------------------------------- +-Wanalyzer-double-free | LOW | 1 +----------------------------------------------------- +----=================---- + +----==== File Statistics ====---- +---------------------------------- +File name | Number of reports +---------------------------------- +gcc_simple.cpp | 1 +---------------------------------- +----=================---- + +----======== Summary ========---- +--------------------------------------------- +Number of processed analyzer result files | 1 +Number of analyzer reports | 1 +--------------------------------------------- +----=================---- diff --git a/config/labels/analyzers/gcc.json b/config/labels/analyzers/gcc.json new file mode 100644 index 0000000000..c71860920f --- /dev/null +++ b/config/labels/analyzers/gcc.json @@ -0,0 +1,285 @@ +{ + "analyzer": "gcc", + "labels": { + "-Wanalyzer-allocation-size": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-allocation-size", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-deref-before-check": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-deref-before-check", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-double-fclose": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-fclose", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-double-free": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-exposure-through-output-file": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-output-file", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-exposure-through-uninit-copy": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-uninit-copy", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-access-mode-mismatch": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-access-mode-mismatch", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-double-close": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-double-close", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-leak": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-phase-mismatch": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-phase-mismatch", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-type-mismatch": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-type-mismatch", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-use-after-close": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-after-close", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-fd-use-without-check": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-without-check", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-file-leak": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-file-leak", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-free-of-non-heap": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-free-of-non-heap", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-imprecise-fp-arithmetic": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-imprecise-fp-arithmetic", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-infinite-recursion": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-infinite-recursion", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-jump-through-null": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-jump-through-null", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-malloc-leak": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-malloc-leak", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-mismatching-deallocation": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-mismatching-deallocation", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-null-argument": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-argument", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-null-dereference": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-dereference", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-out-of-bounds": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-out-of-bounds", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-overlapping-buffers": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-overlapping-buffers", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-possible-null-argument": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-argument", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-possible-null-dereference": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-dereference", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-putenv-of-auto-var": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-putenv-of-auto-var", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-shift-count-negative": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-negative", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-shift-count-overflow": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-overflow", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-stale-setjmp-buffer": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-stale-setjmp-buffer", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-unsafe-call-within-signal-handler": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-unsafe-call-within-signal-handler", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-use-after-free": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-after-free", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-use-of-pointer-in-stale-stack-frame": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-pointer-in-stale-stack-frame", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-use-of-uninitialized-value": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-uninitialized-value", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-va-arg-type-mismatch": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-arg-type-mismatch", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-va-list-exhausted": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-exhausted", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-va-list-leak": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-leak", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-va-list-use-after-va-end": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-use-after-va-end", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-write-to-const": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-const", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ], + "-Wanalyzer-write-to-string-literal": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-string-literal", + "profile:extreme", + "profile:security", + "profile:sensitive", + "severity:LOW" + ] + } +} diff --git a/config/package_layout.json b/config/package_layout.json index abfef0572f..49579fe89b 100644 --- a/config/package_layout.json +++ b/config/package_layout.json @@ -3,7 +3,8 @@ "analyzers": { "clangsa": "clang", "clang-tidy": "clang-tidy", - "cppcheck": "cppcheck" + "cppcheck": "cppcheck", + "gcc": "g++" }, "clang-apply-replacements": "clang-apply-replacements" }, diff --git a/docs/README.md b/docs/README.md index 539092b6c0..2e6357e7e7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,7 +32,7 @@ macOS (OS X) development environment. # Main features ## Command line C/C++ Analysis - * Executes [_Clang-Tidy_](http://clang.llvm.org/extra/clang-tidy/), [_Clang Static Analyzer_](http://clang-analyzer.llvm.org/) with Cross-Translation Unit analysis, Statistical Analysis (when checkers are available), and [_Cppcheck_](https://cppcheck.sourceforge.io/). + * Executes [_Clang-Tidy_](http://clang.llvm.org/extra/clang-tidy/), [_Clang Static Analyzer_](http://clang-analyzer.llvm.org/) with Cross-Translation Unit analysis, Statistical Analysis (when checkers are available), [_Cppcheck_](https://cppcheck.sourceforge.io/), and the [_GCC Static Analyzer_](https://gcc.gnu.org/wiki/StaticAnalyzer). * Creates the JSON compilation database by wiretapping any build process (e.g., `CodeChecker log -b "make"`). * Automatically analyzes GCC cross-compiled projects: detecting GCC or Clang compiler configuration and forming the corresponding clang analyzer invocations. * Incremental analysis: Only the changed files and its dependencies need to be reanalyzed. @@ -238,8 +238,9 @@ The following commands are used to bootstrap CodeChecker on Ubuntu 20.04 LTS: # NOTE: clang or clang-tidy can be any sufficiently fresh version, and need not # come from package manager! # In case of Cppcheck, the minimal supported version is 1.80. -sudo apt-get install clang clang-tidy cppcheck build-essential curl gcc-multilib \ - git python3-dev python3-venv python3-setuptools +# In case of gcc, the minimal supported version is 13.0.0. +sudo apt-get install clang clang-tidy cppcheck g++ build-essential curl + gcc-multilib git python3-dev python3-venv python3-setuptools # Install nodejs dependency for web. In case of Debian/Ubuntu you can use the # following commands. For more information see the official docs: diff --git a/docs/analyzer/checker_and_analyzer_configuration.md b/docs/analyzer/checker_and_analyzer_configuration.md index 21c41a7d68..7adda1631d 100644 --- a/docs/analyzer/checker_and_analyzer_configuration.md +++ b/docs/analyzer/checker_and_analyzer_configuration.md @@ -267,3 +267,7 @@ CodeChecker check -l ./compile_commands.json \ --analyzer-config cppcheck:inconclusive=true \ # allow inconclusive reports -o ./reports ``` + +# Cppcheck + +TODO diff --git a/docs/analyzer/user_guide.md b/docs/analyzer/user_guide.md index 00b6a576ba..ca48db0c28 100644 --- a/docs/analyzer/user_guide.md +++ b/docs/analyzer/user_guide.md @@ -1168,11 +1168,13 @@ analyzer arguments: CodeChecker supports several analyzer tools. Currently, these analyzers are the [_Clang Static Analyzer_](http://clang-analyzer.llvm.org), -[_Clang-Tidy_](http://clang.llvm.org/extra/clang-tidy) and -[_Cppcheck_](http://cppcheck.sourceforge.net/). `--analyzers` can be -used to specify which analyzer tool should be used (by default, all supported -are used). The tools are completely independent, so either can be omitted if -not present as they are provided by different binaries. +[_Clang-Tidy_](http://clang.llvm.org/extra/clang-tidy), +[_Cppcheck_](http://cppcheck.sourceforge.net/) and +[_GCC Static Analyzer_](https://gcc.gnu.org/wiki/StaticAnalyzer). +`--analyzers` can be used to specify which analyzer tool should be used (by +default, all supported are used). The tools are completely independent, so +either can be omitted if not present as they are provided by different +binaries. See [Configure Clang Static Analyzer and checkers](checker_and_analyzer_configuration.md) documentation for a more detailed description how to use the `saargs`, From fdd6a7769959d160c80c294f36fc64413958c9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Wed, 11 Oct 2023 16:33:26 +0200 Subject: [PATCH 02/11] Remove get_analyzer_mentioned_files --- analyzer/.coverage | Bin 110592 -> 0 bytes .../analyzers/gcc/analyzer.py | 10 +--------- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 analyzer/.coverage diff --git a/analyzer/.coverage b/analyzer/.coverage deleted file mode 100644 index 80261d58ae0c6c65656b6059d4eb7759f5d718b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 110592 z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`vJ;`eHKm2A4b{#3Yd* zN=%O9qwC7F5wpq1^90be=CC! J1St#X{vTY}>U;nI diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 27d181c4e9..4c099cc4e2 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -46,15 +46,7 @@ def get_version(cls, env=None): return cls.__get_analyzer_version(cls.analyzer_binary(), env) def add_checker_config(self, checker_cfg): - LOG.error("Checker configuration for Gcc is not implemented yet") - - def get_analyzer_mentioned_files(self, output): - """ - Return a collection of files that were mentioned by the analyzer in - its standard outputs, which should be analyzer_stdout or - analyzer_stderr from a result handler. - """ - pass + LOG.warning("Checker configuration for Gcc is not implemented yet") def construct_analyzer_cmd(self, result_handler): """ From a40dfd31254dada383420561d821a1a2ed6c036e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Thu, 12 Oct 2023 13:52:44 +0200 Subject: [PATCH 03/11] Better error messages for analyzer version mismatch --- .../analyzers/analyzer_base.py | 11 ++++++++--- .../analyzers/analyzer_types.py | 10 +++++++--- .../analyzers/clangsa/analyzer.py | 6 +++--- .../analyzers/clangtidy/analyzer.py | 6 +++--- .../analyzers/cppcheck/analyzer.py | 7 ++++--- .../analyzers/gcc/analyzer.py | 18 +++++++++++------- 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_base.py b/analyzer/codechecker_analyzer/analyzers/analyzer_base.py index 639e6eb0b9..a95059a946 100644 --- a/analyzer/codechecker_analyzer/analyzers/analyzer_base.py +++ b/analyzer/codechecker_analyzer/analyzers/analyzer_base.py @@ -17,6 +17,8 @@ import sys import shlex +from typing import Optional + from codechecker_analyzer import analyzer_context from codechecker_common.logger import get_logger @@ -55,11 +57,14 @@ def resolve_missing_binary(cls, configured_binary, environ): raise NotImplementedError("Subclasses should implement this!") @classmethod - def version_compatible(cls, configured_binary, environ): + def is_binary_version_incompatible(cls, configured_binary, environ) \ + -> Optional[str]: """ CodeChecker can only execute certain versions of analyzers. - This function should return True if the analyzer binary is - compatible with the current CodeChecker version. + Returns a error object (an optional string). If the return value is + None, the analyzer binary is compatible with the current CodeChecker + version. Otherwise, the it should be a message describing the precise + version mismatch. """ raise NotImplementedError("Subclasses should implement this!") diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py index 943a11ee27..39323a167d 100644 --- a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py +++ b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py @@ -186,9 +186,11 @@ def check_supported_analyzers(analyzers): # Check version compatibility of the analyzer binary. if analyzer_bin: analyzer = supported_analyzers[analyzer_name] - if not analyzer.version_compatible(analyzer_bin, check_env): + error = analyzer.is_binary_version_incompatible(analyzer_bin, + check_env) + if error: failed_analyzers.add((analyzer_name, - "Incompatible version.")) + f"Incompatible version: {error}")) available_analyzer = False if not analyzer_bin or \ @@ -221,7 +223,9 @@ def construct_analyzer(buildaction, except Exception as ex: LOG.debug_analyzer(ex) - return None + # We should've detected well before this point that something is off + # with the analyzer. We can't recover here. + raise def build_config_handlers(args, enabled_analyzers): diff --git a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py index 73f0118e94..1a483a095d 100644 --- a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py @@ -578,11 +578,11 @@ def resolve_missing_binary(cls, configured_binary, environ): return clang @classmethod - def version_compatible(cls, configured_binary, environ): + def is_binary_version_incompatible(cls, configured_binary, environ): """ - Check the version compatibility of the given analyzer binary. + We support pretty much every ClangSA version. """ - return True + return None def construct_result_handler(self, buildaction, report_output, skiplist_handler): diff --git a/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py b/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py index 3815792421..6547a0184d 100644 --- a/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py @@ -533,11 +533,11 @@ def resolve_missing_binary(cls, configured_binary, environ): return clangtidy @classmethod - def version_compatible(cls, configured_binary, environ): + def is_binary_version_incompatible(cls, configured_binary, environ): """ - Check the version compatibility of the given analyzer binary. + We support pretty much every Clang-Tidy version. """ - return True + return None def construct_result_handler(self, buildaction, report_output, skiplist_handler): diff --git a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py index 8f4d962fbb..2502ded724 100644 --- a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py @@ -351,7 +351,7 @@ def __get_analyzer_version(cls, analyzer_binary, env): return [] @classmethod - def version_compatible(cls, configured_binary, environ): + def is_binary_version_incompatible(cls, configured_binary, environ): """ Check the version compatibility of the given analyzer binary. """ @@ -361,9 +361,10 @@ def version_compatible(cls, configured_binary, environ): # The analyzer version should be above 1.80 because '--plist-output' # argument was introduced in this release. if analyzer_version >= StrictVersion("1.80"): - return True + return None - return False + return "CppCheck binary found is too old at " \ + f"v{str(analyzer_version).strip()}; minimum version is 13.0.0." def construct_result_handler(self, buildaction, report_output, skiplist_handler): diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 4c099cc4e2..72100a5eaf 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -48,6 +48,13 @@ def get_version(cls, env=None): def add_checker_config(self, checker_cfg): LOG.warning("Checker configuration for Gcc is not implemented yet") + @classmethod + def get_analyzer_mentioned_files(self, output): + """ + This is mostly used for CTU, which is absent in GCC. + """ + pass + def construct_analyzer_cmd(self, result_handler): """ Construct analyzer command for gcc. @@ -185,7 +192,7 @@ def __get_analyzer_version(cls, analyzer_binary, env): return None @classmethod - def version_compatible(cls, configured_binary, environ): + def is_binary_version_incompatible(cls, configured_binary, environ): """ Check the version compatibility of the given analyzer binary. """ @@ -196,13 +203,10 @@ def version_compatible(cls, configured_binary, environ): # '-fdiagnostics-format=sarif-file' argument was introduced in this # release. if analyzer_version >= StrictVersion("13.0.0"): - return True + return None - # FIXME: Maybe this isn't to place to emit an error, especially when - # we cycle over multiple binarier to find the correct one. - LOG.error("GCC binary found is too old at " - f"v{analyzer_version.strip()}; minimum version is 13.0.0.") - return False + return f"GCC binary found is too old at v{analyzer_version.strip()}; "\ + "minimum version is 13.0.0." def construct_result_handler(self, buildaction, report_output, skiplist_handler): From 3093ec6c7caf107b58e98121377f4180368c3dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Thu, 12 Oct 2023 16:14:56 +0200 Subject: [PATCH 04/11] Replace -Wanalyzer with gcc in the checker name --- .../analyzers/gcc/analyzer.py | 58 +++++--------- .../analyzers/gcc/result_handler.py | 22 ++++- config/labels/analyzers/gcc.json | 80 +++++++++---------- 3 files changed, 79 insertions(+), 81 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 72100a5eaf..279ddab5e9 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -21,9 +21,12 @@ from .. import analyzer_base from ..flag import has_flag +from ..config_handler import CheckerState from .config_handler import GccConfigHandler -from .result_handler import GccResultHandler +from .result_handler import GccResultHandler, \ + actual_name_to_codechecker_name, codechecker_name_to_actual_name, \ + codechecker_name_to_actual_name_disabled LOG = get_logger('analyzer.gcc') @@ -76,6 +79,13 @@ def construct_analyzer_cmd(self, result_handler): analyzer_cmd.append('-fdiagnostics-format=sarif-file') + for checker_name, value in config.checks().items(): + if value[0] == CheckerState.disabled: + # TODO python3.9 removeprefix method would be nicer + # than startswith and a hardcoded slicing + analyzer_cmd.append( + codechecker_name_to_actual_name_disabled(checker_name)) + compile_lang = self.buildaction.lang if not has_flag('-x', analyzer_cmd): analyzer_cmd.extend(['-x', compile_lang]) @@ -88,11 +98,11 @@ def construct_analyzer_cmd(self, result_handler): return analyzer_cmd @classmethod - def get_analyzer_checkers(cls): + def get_analyzer_checkers(self): """ Return the list of the supported checkers. """ - command = [cls.analyzer_binary(), "--help=warning"] + command = [self.analyzer_binary(), "--help=warning"] checker_list = [] try: @@ -101,8 +111,13 @@ def get_analyzer_checkers(cls): # Still contains the help message we need to remove. for entry in output.decode().split('\n'): warning_name, _, description = entry.strip().partition(' ') + # GCC Static Analyzer names start with -Wanalyzer. if warning_name.startswith('-Wanalyzer'): - checker_list.append((warning_name, description)) + # Rename the checkers interally (similarly to how we + # support cppcheck) + renamed_checker_name = \ + actual_name_to_codechecker_name(warning_name) + checker_list.append((renamed_checker_name, description)) return checker_list except (subprocess.CalledProcessError) as e: LOG.error(e.stderr) @@ -154,21 +169,8 @@ def resolve_missing_binary(cls, configured_binary, env): In case of the configured binary for the analyzer is not found in the PATH, this method is used to find a callable binary. """ - - LOG.error("%s not found in path for GCC!", configured_binary) - - # if os.path.isabs(configured_binary): - # # Do not autoresolve if the path is an absolute path as there - # # is nothing we could auto-resolve that way. - # return False - - # cppcheck = get_binary_in_path(['g++-13'], - # r'^cppcheck(-\d+(\.\d+){0,2})?$', - # env) - - # if cppcheck: - # LOG.debug("Using '%s' for Cppcheck!", cppcheck) - # return cppcheck + # TODO + pass @classmethod def __get_analyzer_version(cls, analyzer_binary, env): @@ -222,7 +224,6 @@ def construct_result_handler(self, buildaction, report_output, @classmethod def construct_config_handler(cls, args): - context = analyzer_context.get_context() handler = GccConfigHandler() analyzer_config = defaultdict(list) @@ -235,25 +236,8 @@ def construct_config_handler(cls, args): handler.analyzer_config = analyzer_config - # check_env = context.analyzer_env - - # # Overwrite PATH to contain only the parent of the cppcheck binary. - # if os.path.isabs(Gcc.analyzer_binary()): - # check_env['PATH'] = os.path.dirname(Gcc.analyzer_binary()) - checkers = cls.get_analyzer_checkers() - # Cppcheck can and will report with checks that have a different - # name than marked in the --errorlist xml. To be able to suppress - # these reports, the checkerlist needs to be extended by those found - # in the label file. - checker_labels = context.checker_labels - checkers_from_label = checker_labels.checkers("gcc") - parsed_set = set([data[0] for data in checkers]) - for checker in set(checkers_from_label): - if checker not in parsed_set: - checkers.append((checker, "")) - try: cmdline_checkers = args.ordered_checkers except AttributeError: diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py b/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py index 6a02648bf6..8040d3b7ff 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py @@ -27,6 +27,21 @@ LOG = get_logger('analyzer.gcc') +def actual_name_to_codechecker_name(actual_name: str): + assert actual_name.startswith('-Wanalyzer') + return actual_name.replace("-Wanalyzer", "gcc") + + +def codechecker_name_to_actual_name(codechecker_name: str): + assert codechecker_name.startswith('gcc') + return codechecker_name.replace("gcc", "-Wanalyzer") + + +def codechecker_name_to_actual_name_disabled(codechecker_name: str): + assert codechecker_name.startswith('gcc') + return codechecker_name.replace("gcc", "-Wno-analyzer") + + class GccResultHandler(ResultHandler): """ Create analyzer result file for Gcc output. @@ -57,10 +72,9 @@ def postprocess_result(self, skip_handlers: Optional[SkipListHandlers]): source_dir_path=self.source_dir_path) reports = [r for r in reports if not r.skip(skip_handlers)] - # for report in reports: - # # TODO check if prefix cascading still occurs. - # if not report.checker_name.startswith("gcc-"): - # report.checker_name = "gcc-" + report.checker_name + for report in reports: + report.checker_name = \ + actual_name_to_codechecker_name(report.checker_name) hash_type = HashType.PATH_SENSITIVE if self.report_hash_type == 'context-free-v2': diff --git a/config/labels/analyzers/gcc.json b/config/labels/analyzers/gcc.json index c71860920f..ede9aeab0d 100644 --- a/config/labels/analyzers/gcc.json +++ b/config/labels/analyzers/gcc.json @@ -1,280 +1,280 @@ { "analyzer": "gcc", "labels": { - "-Wanalyzer-allocation-size": [ + "gcc-allocation-size": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-allocation-size", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-deref-before-check": [ + "gcc-deref-before-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-deref-before-check", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-double-fclose": [ + "gcc-double-fclose": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-fclose", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-double-free": [ + "gcc-double-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-exposure-through-output-file": [ + "gcc-exposure-through-output-file": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-output-file", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-exposure-through-uninit-copy": [ + "gcc-exposure-through-uninit-copy": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-uninit-copy", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-access-mode-mismatch": [ + "gcc-fd-access-mode-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-access-mode-mismatch", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-double-close": [ + "gcc-fd-double-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-double-close", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-leak": [ + "gcc-fd-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-phase-mismatch": [ + "gcc-fd-phase-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-phase-mismatch", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-type-mismatch": [ + "gcc-fd-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-type-mismatch", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-use-after-close": [ + "gcc-fd-use-after-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-after-close", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-fd-use-without-check": [ + "gcc-fd-use-without-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-without-check", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-file-leak": [ + "gcc-file-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-file-leak", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-free-of-non-heap": [ + "gcc-free-of-non-heap": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-free-of-non-heap", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-imprecise-fp-arithmetic": [ + "gcc-imprecise-fp-arithmetic": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-imprecise-fp-arithmetic", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-infinite-recursion": [ + "gcc-infinite-recursion": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-infinite-recursion", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-jump-through-null": [ + "gcc-jump-through-null": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-jump-through-null", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-malloc-leak": [ + "gcc-malloc-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-malloc-leak", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-mismatching-deallocation": [ + "gcc-mismatching-deallocation": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-mismatching-deallocation", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-null-argument": [ + "gcc-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-argument", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-null-dereference": [ + "gcc-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-dereference", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-out-of-bounds": [ + "gcc-out-of-bounds": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-out-of-bounds", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-overlapping-buffers": [ + "gcc-overlapping-buffers": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-overlapping-buffers", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-possible-null-argument": [ + "gcc-possible-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-argument", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-possible-null-dereference": [ + "gcc-possible-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-dereference", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-putenv-of-auto-var": [ + "gcc-putenv-of-auto-var": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-putenv-of-auto-var", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-shift-count-negative": [ + "gcc-shift-count-negative": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-negative", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-shift-count-overflow": [ + "gcc-shift-count-overflow": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-overflow", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-stale-setjmp-buffer": [ + "gcc-stale-setjmp-buffer": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-stale-setjmp-buffer", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-unsafe-call-within-signal-handler": [ + "gcc-unsafe-call-within-signal-handler": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-unsafe-call-within-signal-handler", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-use-after-free": [ + "gcc-use-after-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-after-free", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-use-of-pointer-in-stale-stack-frame": [ + "gcc-use-of-pointer-in-stale-stack-frame": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-pointer-in-stale-stack-frame", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-use-of-uninitialized-value": [ + "gcc-use-of-uninitialized-value": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-uninitialized-value", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-va-arg-type-mismatch": [ + "gcc-va-arg-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-arg-type-mismatch", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-va-list-exhausted": [ + "gcc-va-list-exhausted": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-exhausted", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-va-list-leak": [ + "gcc-va-list-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-leak", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-va-list-use-after-va-end": [ + "gcc-va-list-use-after-va-end": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-use-after-va-end", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-write-to-const": [ + "gcc-write-to-const": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-const", "profile:extreme", "profile:security", "profile:sensitive", "severity:LOW" ], - "-Wanalyzer-write-to-string-literal": [ + "gcc-write-to-string-literal": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-string-literal", "profile:extreme", "profile:security", From 16a76a67ca22d85c93487a62bff2cdde953f6cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Thu, 12 Oct 2023 16:56:54 +0200 Subject: [PATCH 05/11] Add test for gcc checker disable --- .../analyzers/gcc/analyzer.py | 3 +- .../test_files/gcc_simple.output | 12 ++++---- .../gcc_simple_checker_disable.output | 28 +++++++++++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 279ddab5e9..04e64d87b1 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -117,7 +117,8 @@ def get_analyzer_checkers(self): # support cppcheck) renamed_checker_name = \ actual_name_to_codechecker_name(warning_name) - checker_list.append((renamed_checker_name, description)) + checker_list.append( + (renamed_checker_name, description.strip())) return checker_list except (subprocess.CalledProcessError) as e: LOG.error(e.stderr) diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output index d1eaa56193..814328d7c9 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output @@ -18,7 +18,7 @@ CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --an [] - To store results use the "CodeChecker store" command. [] - See --help and the user guide for further options about parsing and storing the reports. [] - ----=================---- -[LOW] gcc_simple.cpp:5:3: double-‘free’ of ‘i’ [-Wanalyzer-double-free] +[LOW] gcc_simple.cpp:5:3: double-‘free’ of ‘i’ [gcc-double-free] free(i); ^ @@ -34,11 +34,11 @@ LOW | 1 ----=================---- ----==== Checker Statistics ====---- ------------------------------------------------------ -Checker name | Severity | Number of reports ------------------------------------------------------ --Wanalyzer-double-free | LOW | 1 ------------------------------------------------------ +---------------------------------------------- +Checker name | Severity | Number of reports +---------------------------------------------- +gcc-double-free | LOW | 1 +---------------------------------------------- ----=================---- ----==== File Statistics ====---- diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output new file mode 100644 index 0000000000..75edcece32 --- /dev/null +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output @@ -0,0 +1,28 @@ +NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet +NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive -d gcc-double-free +NORMAL#CodeChecker parse $OUTPUT$ +CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=sensitive -d gcc-double-free +----------------------------------------------- +[] - Starting build... +[] - Using CodeChecker ld-logger. +[] - Build finished successfully. +[] - Starting static analysis ... +[] - [1/1] gcc analyzed gcc_simple.cpp successfully. +[] - ----==== Summary ====---- +[] - Successfully analyzed +[] - gcc: 1 +[] - Total analyzed compilation commands: 1 +[] - ----=================---- +[] - Analysis finished. +[] - To view results in the terminal use the "CodeChecker parse" command. +[] - To store results use the "CodeChecker store" command. +[] - See --help and the user guide for further options about parsing and storing the reports. +[] - ----=================---- +Found no defects in gcc_simple.cpp + +----======== Summary ========---- +--------------------------------------------- +Number of processed analyzer result files | 1 +Number of analyzer reports | 0 +--------------------------------------------- +----=================---- From 084779d976825a934a212a2f8ccad168d6d0a520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Thu, 12 Oct 2023 17:34:22 +0200 Subject: [PATCH 06/11] Make linters happy --- analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 04e64d87b1..0b1caa75dc 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -25,8 +25,7 @@ from .config_handler import GccConfigHandler from .result_handler import GccResultHandler, \ - actual_name_to_codechecker_name, codechecker_name_to_actual_name, \ - codechecker_name_to_actual_name_disabled + actual_name_to_codechecker_name, codechecker_name_to_actual_name_disabled LOG = get_logger('analyzer.gcc') From 64b916787d5eb21bf97469c2e73f504332ff8db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Fri, 13 Oct 2023 15:41:36 +0200 Subject: [PATCH 07/11] Only leave the extreme profile on gcc checkers --- .../analyzers/gcc/analyzer.py | 3 +- .../test_files/gcc_simple.output | 2 +- .../gcc_simple_checker_disable.output | 2 +- config/labels/analyzers/gcc.json | 80 ------------------- 4 files changed, 4 insertions(+), 83 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 0b1caa75dc..9c5633ae05 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -48,7 +48,8 @@ def get_version(cls, env=None): return cls.__get_analyzer_version(cls.analyzer_binary(), env) def add_checker_config(self, checker_cfg): - LOG.warning("Checker configuration for Gcc is not implemented yet") + # TODO + pass @classmethod def get_analyzer_mentioned_files(self, output): diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output index 814328d7c9..96427489c2 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output @@ -1,7 +1,7 @@ NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive NORMAL#CodeChecker parse $OUTPUT$ -CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=sensitive +CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=extreme ----------------------------------------------- [] - Starting build... [] - Using CodeChecker ld-logger. diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output index 75edcece32..76757cc4f6 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output @@ -1,7 +1,7 @@ NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive -d gcc-double-free NORMAL#CodeChecker parse $OUTPUT$ -CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=sensitive -d gcc-double-free +CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=extreme -d gcc-double-free ----------------------------------------------- [] - Starting build... [] - Using CodeChecker ld-logger. diff --git a/config/labels/analyzers/gcc.json b/config/labels/analyzers/gcc.json index ede9aeab0d..eafbb20ef7 100644 --- a/config/labels/analyzers/gcc.json +++ b/config/labels/analyzers/gcc.json @@ -4,281 +4,201 @@ "gcc-allocation-size": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-allocation-size", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-deref-before-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-deref-before-check", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-double-fclose": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-fclose", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-double-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-exposure-through-output-file": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-output-file", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-exposure-through-uninit-copy": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-uninit-copy", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-access-mode-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-access-mode-mismatch", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-double-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-double-close", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-phase-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-phase-mismatch", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-type-mismatch", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-use-after-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-after-close", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-fd-use-without-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-without-check", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-file-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-file-leak", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-free-of-non-heap": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-free-of-non-heap", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-imprecise-fp-arithmetic": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-imprecise-fp-arithmetic", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-infinite-recursion": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-infinite-recursion", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-jump-through-null": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-jump-through-null", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-malloc-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-malloc-leak", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-mismatching-deallocation": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-mismatching-deallocation", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-argument", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-dereference", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-out-of-bounds": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-out-of-bounds", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-overlapping-buffers": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-overlapping-buffers", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-possible-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-argument", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-possible-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-dereference", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-putenv-of-auto-var": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-putenv-of-auto-var", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-shift-count-negative": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-negative", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-shift-count-overflow": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-overflow", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-stale-setjmp-buffer": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-stale-setjmp-buffer", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-unsafe-call-within-signal-handler": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-unsafe-call-within-signal-handler", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-use-after-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-after-free", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-use-of-pointer-in-stale-stack-frame": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-pointer-in-stale-stack-frame", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-use-of-uninitialized-value": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-uninitialized-value", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-va-arg-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-arg-type-mismatch", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-va-list-exhausted": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-exhausted", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-va-list-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-leak", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-va-list-use-after-va-end": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-use-after-va-end", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-write-to-const": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-const", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ], "gcc-write-to-string-literal": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-string-literal", "profile:extreme", - "profile:security", - "profile:sensitive", "severity:LOW" ] } From 3f058ebb8f8ebfa55cc9c84aa6485cb387f47889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Mon, 16 Oct 2023 10:07:39 +0200 Subject: [PATCH 08/11] Change severity to unspecified, add stubs for the docs --- .../analyzers/cppcheck/analyzer.py | 2 +- config/labels/analyzers/gcc.json | 113 +++++++++++------- .../checker_and_analyzer_configuration.md | 22 +++- docs/supported_code_analyzers.md | 3 +- 4 files changed, 90 insertions(+), 50 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py index 2502ded724..4d891142fc 100644 --- a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py @@ -364,7 +364,7 @@ def is_binary_version_incompatible(cls, configured_binary, environ): return None return "CppCheck binary found is too old at " \ - f"v{str(analyzer_version).strip()}; minimum version is 13.0.0." + f"v{str(analyzer_version).strip()}; minimum version is 1.80" def construct_result_handler(self, buildaction, report_output, skiplist_handler): diff --git a/config/labels/analyzers/gcc.json b/config/labels/analyzers/gcc.json index eafbb20ef7..54fe7f2060 100644 --- a/config/labels/analyzers/gcc.json +++ b/config/labels/analyzers/gcc.json @@ -4,202 +4,227 @@ "gcc-allocation-size": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-allocation-size", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-deref-before-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-deref-before-check", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-double-fclose": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-fclose", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-double-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-double-free", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-exposure-through-output-file": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-output-file", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-exposure-through-uninit-copy": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-exposure-through-uninit-copy", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-access-mode-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-access-mode-mismatch", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-double-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-double-close", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-phase-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-phase-mismatch", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-type-mismatch", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-use-after-close": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-after-close", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-fd-use-without-check": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-use-without-check", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-file-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-file-leak", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-free-of-non-heap": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-free-of-non-heap", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-imprecise-fp-arithmetic": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-imprecise-fp-arithmetic", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-infinite-recursion": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-infinite-recursion", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-jump-through-null": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-jump-through-null", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-malloc-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-malloc-leak", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-mismatching-deallocation": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-mismatching-deallocation", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-argument", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-dereference", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-out-of-bounds": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-out-of-bounds", "profile:extreme", - "severity:LOW" - ], - "gcc-overlapping-buffers": [ - "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-overlapping-buffers", - "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-possible-null-argument": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-argument", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-possible-null-dereference": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-possible-null-dereference", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-putenv-of-auto-var": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-putenv-of-auto-var", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-shift-count-negative": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-negative", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-shift-count-overflow": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-shift-count-overflow", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-stale-setjmp-buffer": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-stale-setjmp-buffer", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" + ], + "gcc-tainted-allocation-size": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-allocation-size", + "profile:extreme", + "severity:UNSPECIFIED" + ], + "gcc-tainted-array-index": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-array-index", + "profile:extreme", + "severity:UNSPECIFIED" + ], + "gcc-tainted-assertion": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-assertion", + "profile:extreme", + "severity:UNSPECIFIED" + ], + "gcc-tainted-divisor": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-divisor", + "profile:extreme", + "severity:UNSPECIFIED" + ], + "gcc-tainted-offset": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-offset", + "profile:extreme", + "severity:UNSPECIFIED" + ], + "gcc-tainted-size": [ + "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-tainted-size", + "profile:extreme", + "severity:UNSPECIFIED" ], "gcc-unsafe-call-within-signal-handler": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-unsafe-call-within-signal-handler", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-use-after-free": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-after-free", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-use-of-pointer-in-stale-stack-frame": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-pointer-in-stale-stack-frame", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-use-of-uninitialized-value": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-use-of-uninitialized-value", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-va-arg-type-mismatch": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-arg-type-mismatch", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-va-list-exhausted": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-exhausted", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-va-list-leak": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-leak", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-va-list-use-after-va-end": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-va-list-use-after-va-end", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-write-to-const": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-const", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ], "gcc-write-to-string-literal": [ "doc_url:https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-write-to-string-literal", "profile:extreme", - "severity:LOW" + "severity:UNSPECIFIED" ] } } diff --git a/docs/analyzer/checker_and_analyzer_configuration.md b/docs/analyzer/checker_and_analyzer_configuration.md index 7adda1631d..1a63382387 100644 --- a/docs/analyzer/checker_and_analyzer_configuration.md +++ b/docs/analyzer/checker_and_analyzer_configuration.md @@ -1,4 +1,4 @@ -# Configure Clang Static Analyzer and checkers +# Configuring Clang Static Analyzer and checkers ## Analyzer Configuration @@ -195,11 +195,11 @@ configuration arguments (json in this case) should be in one line : -config="{ "Checks": "clang-diagnostic-*,clang-analyzer-*", "WarningsAsErrors": "", "HeaderFilterRegex": "", "AnalyzeTemporaryDtors": false, "CheckOptions": [ { "key": "google-readability-braces-around-statements.ShortStatementLines", "value": "1" }, { "key": "modernize-loop-convert.MaxCopySize", "value": "16" }, { "key": "modernize-loop-convert.NamingStyle", "value": "CamelCase" }, { "key": "modernize-use-nullptr.NullMacros", "value": "NULL" } ] }" ``` -# Cppcheck +# Configuring Cppcheck As of CodeChecker 6.20, Codechecker can now execute the Cppcheck analyzer. -## Configuration +## Analyzer Configuration The Cppcheck analyzer can be configured with --analyzer-config cppcheck:* paramterers. @@ -268,6 +268,20 @@ CodeChecker check -l ./compile_commands.json \ -o ./reports ``` -# Cppcheck +# GCC Static Analyzer + +As of CodeChecker 6.23, Codechecker can now execute the GCC Static Analyzer. + +## Analyzer Configuration + +TODO: gcc-too-complex + +## Limitations + +TODO + +Gcc doesn't well with C++. Prefer only running on C. + +## Example invocation TODO diff --git a/docs/supported_code_analyzers.md b/docs/supported_code_analyzers.md index 3dfc4a4b2d..3ce580e5c9 100644 --- a/docs/supported_code_analyzers.md +++ b/docs/supported_code_analyzers.md @@ -1,9 +1,10 @@ ## Code Analysis tools -CodeChecker can execute three main `C/C++` static analyzer tools: +CodeChecker can execute the following static analyzer tools: - [Clang Tidy](https://clang.llvm.org/extra/clang-tidy/) - [Clang Static Analyzer](https://clang-analyzer.llvm.org/) - [Cppcheck](https://cppcheck.sourceforge.io/) +- [GCC Static Analyzer](https://gcc.gnu.org/wiki/StaticAnalyzer) We have created a separate [converter tool](/tools/report-converter) which can be used to convert the output of different source code analyzer tools to a From bb211783d0d9039398cc1f401847b1ad55ce5f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Mon, 16 Oct 2023 10:23:20 +0200 Subject: [PATCH 09/11] fix a test --- .../test_files/gcc_simple.output | 24 +++++++++---------- .../gcc_simple_checker_disable.output | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output index 96427489c2..0a75a3d158 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple.output @@ -1,5 +1,5 @@ NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet -NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive +NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=extreme NORMAL#CodeChecker parse $OUTPUT$ CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=extreme ----------------------------------------------- @@ -18,7 +18,7 @@ CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --an [] - To store results use the "CodeChecker store" command. [] - See --help and the user guide for further options about parsing and storing the reports. [] - ----=================---- -[LOW] gcc_simple.cpp:5:3: double-‘free’ of ‘i’ [gcc-double-free] +[UNSPECIFIED] gcc_simple.cpp:5:3: double-‘free’ of ‘i’ [gcc-double-free] free(i); ^ @@ -26,19 +26,19 @@ Found 1 defect(s) in gcc_simple.cpp ----==== Severity Statistics ====---- ----------------------------- -Severity | Number of reports ----------------------------- -LOW | 1 ----------------------------- +------------------------------- +Severity | Number of reports +------------------------------- +UNSPECIFIED | 1 +------------------------------- ----=================---- ----==== Checker Statistics ====---- ----------------------------------------------- -Checker name | Severity | Number of reports ----------------------------------------------- -gcc-double-free | LOW | 1 ----------------------------------------------- +------------------------------------------------- +Checker name | Severity | Number of reports +------------------------------------------------- +gcc-double-free | UNSPECIFIED | 1 +------------------------------------------------- ----=================---- ----==== File Statistics ====---- diff --git a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output index 76757cc4f6..3e30c5b5db 100644 --- a/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output +++ b/analyzer/tests/functional/analyze_and_parse/test_files/gcc_simple_checker_disable.output @@ -1,5 +1,5 @@ NORMAL#CodeChecker log --output $LOGFILE$ --build "make gcc_simple" --quiet -NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=sensitive -d gcc-double-free +NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers gcc --enable=extreme -d gcc-double-free NORMAL#CodeChecker parse $OUTPUT$ CHECK#CodeChecker check --build "make gcc_simple" --output $OUTPUT$ --quiet --analyzers gcc --enable=extreme -d gcc-double-free ----------------------------------------------- From 06199975fc5f59033c7be5c4846178218d02fa87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Mon, 16 Oct 2023 15:07:17 +0200 Subject: [PATCH 10/11] g++ -> gcc --- .github/workflows/install-deps.sh | 8 ++++---- .github/workflows/pypi.yml | 4 ++-- config/package_layout.json | 2 +- docs/README.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 37bf443384..8817d70fc1 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -2,14 +2,14 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' -y -# Required for g++-13, as the latest LTS at the time of this change hasn't made it available. +# Required for gcc-13, as the latest LTS at the time of this change hasn't made it available. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -q sudo apt-get install \ - g++-13 \ - gcc-multilib \ + gcc-13 \ + gcc-13-multilib \ libc6-dev-i386 \ libpq-dev \ libldap2-dev \ @@ -22,4 +22,4 @@ sudo apt-get install \ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 9999 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 9999 sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 9999 -sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 9999 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 9999 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 26836213a0..6e41b574bf 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -73,12 +73,12 @@ jobs: - name: "Install run-time dependencies (Linux)" if: ${{ matrix.os == 'ubuntu-20.04' }} run: - sudo apt-get update && sudo apt-get install g++-13 clang clang-tidy cppcheck + sudo apt-get update && sudo apt-get install gcc-13 clang clang-tidy cppcheck - name: "Install run-time dependencies (OSX)" if: ${{ matrix.os == 'macos-10.15' }} run: - brew install llvm cppcheck g++-13 + brew install llvm cppcheck gcc-13 - name: "Install run-time dependencies (Windows)" if: ${{ matrix.os == 'windows-2019' }} diff --git a/config/package_layout.json b/config/package_layout.json index 49579fe89b..92bda00c4d 100644 --- a/config/package_layout.json +++ b/config/package_layout.json @@ -4,7 +4,7 @@ "clangsa": "clang", "clang-tidy": "clang-tidy", "cppcheck": "cppcheck", - "gcc": "g++" + "gcc": "gcc" }, "clang-apply-replacements": "clang-apply-replacements" }, diff --git a/docs/README.md b/docs/README.md index 2e6357e7e7..c9f5fcf4d3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -239,7 +239,7 @@ The following commands are used to bootstrap CodeChecker on Ubuntu 20.04 LTS: # come from package manager! # In case of Cppcheck, the minimal supported version is 1.80. # In case of gcc, the minimal supported version is 13.0.0. -sudo apt-get install clang clang-tidy cppcheck g++ build-essential curl +sudo apt-get install clang clang-tidy cppcheck gcc build-essential curl gcc-multilib git python3-dev python3-venv python3-setuptools # Install nodejs dependency for web. In case of Debian/Ubuntu you can use the From 0ceff5304205fdb6f03a38fb7d4426165c3b1b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Mon, 16 Oct 2023 16:25:50 +0200 Subject: [PATCH 11/11] gcc -> g++ --- .github/workflows/install-deps.sh | 8 ++++---- .github/workflows/pypi.yml | 4 ++-- config/package_layout.json | 2 +- docs/README.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 8817d70fc1..37bf443384 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -2,14 +2,14 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' -y -# Required for gcc-13, as the latest LTS at the time of this change hasn't made it available. +# Required for g++-13, as the latest LTS at the time of this change hasn't made it available. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -q sudo apt-get install \ - gcc-13 \ - gcc-13-multilib \ + g++-13 \ + gcc-multilib \ libc6-dev-i386 \ libpq-dev \ libldap2-dev \ @@ -22,4 +22,4 @@ sudo apt-get install \ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 9999 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 9999 sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 9999 -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 9999 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 9999 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 6e41b574bf..26836213a0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -73,12 +73,12 @@ jobs: - name: "Install run-time dependencies (Linux)" if: ${{ matrix.os == 'ubuntu-20.04' }} run: - sudo apt-get update && sudo apt-get install gcc-13 clang clang-tidy cppcheck + sudo apt-get update && sudo apt-get install g++-13 clang clang-tidy cppcheck - name: "Install run-time dependencies (OSX)" if: ${{ matrix.os == 'macos-10.15' }} run: - brew install llvm cppcheck gcc-13 + brew install llvm cppcheck g++-13 - name: "Install run-time dependencies (Windows)" if: ${{ matrix.os == 'windows-2019' }} diff --git a/config/package_layout.json b/config/package_layout.json index 92bda00c4d..49579fe89b 100644 --- a/config/package_layout.json +++ b/config/package_layout.json @@ -4,7 +4,7 @@ "clangsa": "clang", "clang-tidy": "clang-tidy", "cppcheck": "cppcheck", - "gcc": "gcc" + "gcc": "g++" }, "clang-apply-replacements": "clang-apply-replacements" }, diff --git a/docs/README.md b/docs/README.md index c9f5fcf4d3..2e6357e7e7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -239,7 +239,7 @@ The following commands are used to bootstrap CodeChecker on Ubuntu 20.04 LTS: # come from package manager! # In case of Cppcheck, the minimal supported version is 1.80. # In case of gcc, the minimal supported version is 13.0.0. -sudo apt-get install clang clang-tidy cppcheck gcc build-essential curl +sudo apt-get install clang clang-tidy cppcheck g++ build-essential curl gcc-multilib git python3-dev python3-venv python3-setuptools # Install nodejs dependency for web. In case of Debian/Ubuntu you can use the