github / codeql-coding-standards

This repository contains CodeQL queries and libraries which support various Coding Standards.
MIT License
129 stars 59 forks source link

`A1-1-2`: does not detect compilations that suppress warnings with `-w` flag #693

Closed MichaelRFairhurst closed 1 month ago

MichaelRFairhurst commented 2 months ago

Affected rules

Description

Currently, A1-1-2 reports compilations that do not specify at least one flag of type -Wfoo. However, clang and gcc both give priority to -w (the flag to suppress errors). Therefore, -w -Wfoo will not show warnings, and should be captured by A1-1-2, but it currently is not.

Note, codeql run test seems to automatically and unconditionally extract with a -w flag. Therefore, it seems that creating a set of compliant/non compliant tests cannot be done with the current test infrastructure.

Example

g++ -w -Wformat test.cpp
clang++ -w -Wformat test.cpp