Skip to content

cswrap-core: skip known wrappers while invoking an analyzer#44

Merged
kdudka merged 1 commit into
csutils:mainfrom
kdudka:reduce-forking
Jul 23, 2024
Merged

cswrap-core: skip known wrappers while invoking an analyzer#44
kdudka merged 1 commit into
csutils:mainfrom
kdudka:reduce-forking

Conversation

@kdudka

@kdudka kdudka commented Jul 19, 2024

Copy link
Copy Markdown
Member

We want to hook gcc -fanalyzer on clang if clang is used as the system compiler. However, it does not make sense to hook GCC Analyzer on clang --analyze, which is invoked by csclng while wrapping gcc as the system compiler.

Apart from wasting resources by running multiple processes of GCC Analyzer in parallel, this was causing unnecessary noise in scan.log as GCC Analyzer complained about unsupported flags, which were injected by csclng for clang --analyze only:

gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’
gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’
gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’

Reported-by: Lukáš Zaoral
Fixes: commit 983b895
Related: #43
Closes: #44

@kdudka kdudka requested a review from lzaoral July 19, 2024 15:38
@kdudka kdudka self-assigned this Jul 19, 2024

@lzaoral lzaoral left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you, @kdudka!

Comment thread src/cswrap-core.c
Comment thread src/cswrap-core.c Outdated
Comment thread src/cswrap-core.c Outdated
Comment thread src/cswrap-core.c
We want to hook `gcc -fanalyzer` on `clang` if `clang` is used as the
system compiler.  However, it does not make sense to hook GCC Analyzer
on `clang --analyze`, which is invoked by `csclng` while wrapping `gcc`
as the system compiler.

Apart from wasting resources by running multiple processes of GCC
Analyzer in parallel, this was causing unnecessary noise in `scan.log`
as GCC Analyzer complained about unsupported flags, which were injected
by `csclng` for `clang --analyze` only:
```
gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’
gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’
gcc: error: unrecognized command-line option ‘-fno-caret-diagnostics’
```

Reported-by: Lukáš Zaoral
Fixes: commit 983b895
Related: csutils#43
Closes: csutils#44
@kdudka kdudka requested a review from lzaoral July 22, 2024 13:10
@kdudka

kdudka commented Jul 23, 2024

Copy link
Copy Markdown
Member Author

@lzaoral Thanks for review!

@kdudka kdudka closed this in 1bbbfa0 Jul 23, 2024
@kdudka kdudka merged commit 1bbbfa0 into csutils:main Jul 23, 2024
@kdudka kdudka deleted the reduce-forking branch July 23, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants