Skip to content

Commit

Permalink
[gcc] Prune "...to here" messages
Browse files Browse the repository at this point in the history
They are unnecessary considering we have arrows for the same purpose.
  • Loading branch information
Szelethus committed Nov 9, 2023
1 parent 869a8ad commit 3fbb810
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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 import Report, report_file
from codechecker_report_converter.report.hash import get_report_hash, HashType

from codechecker_common.logger import get_logger
Expand All @@ -42,6 +42,22 @@ def codechecker_name_to_actual_name_disabled(codechecker_name: str):
return codechecker_name.replace("gcc", "-Wno-analyzer")


def prune_unnecessary_events(report: Report):
"""
GCC (at least around v13) emits diagnostics steps in the following manner:
following ‘false’ branch...
...to here
Besides the funny english, the "to here" notes are unnecessary and
distracting, considering we use arrows for the same purpose, so we prune
them. We also strip the message of leading/trailing dots.
"""
for event in report.bug_path_events.copy():
if event.message == "...to here":
report.bug_path_events.remove(event)
else:
event.message = event.message.strip(".")


class GccResultHandler(ResultHandler):
"""
Create analyzer result file for Gcc output.
Expand Down Expand Up @@ -73,6 +89,7 @@ def postprocess_result(self, skip_handlers: Optional[SkipListHandlers]):

reports = [r for r in reports if not r.skip(skip_handlers)]
for report in reports:
prune_unnecessary_events(report)
report.checker_name = \
actual_name_to_codechecker_name(report.checker_name)

Expand Down

0 comments on commit 3fbb810

Please sign in to comment.