Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A1-1-2: does not understand -Wno-* flags #689

Open
MichaelRFairhurst opened this issue Sep 17, 2024 · 1 comment
Open

A1-1-2: does not understand -Wno-* flags #689

MichaelRFairhurst opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR

Comments

@MichaelRFairhurst
Copy link
Contributor

Affected rules

  • A1-1-2

Description

This rule looks for compilations with no warning flags. However, it will falsely detect -Wno-* flags as if they are warning flags.

Notably, gcc is often built with -Wformat enabled by default. This can be suppressed with -Wno-format, which would cause the false negative.

Note the same issue exists with -w which suppresses all -W* flags, which is failing linux/gcc tests, and I created #688 to fix. However, this issue is, philosophically, one step further yet than that PR in terms of altering current behavior.

Example

g++ -Wno-format test.cpp
@MichaelRFairhurst MichaelRFairhurst added the false positive/false negative An issue related to observed false positives or false negatives. label Sep 17, 2024
@lcartey lcartey added Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address Impact-Medium labels Sep 17, 2024
@lcartey lcartey moved this from Reported to Ready for review in Coding Standards Public Development Board Sep 17, 2024
@lcartey lcartey linked a pull request Sep 17, 2024 that will close this issue
30 tasks
@lcartey lcartey moved this from Ready for review to Assigned in Coding Standards Public Development Board Sep 17, 2024
@lcartey lcartey moved this from Assigned to Triaged in Coding Standards Public Development Board Sep 17, 2024
@MichaelRFairhurst MichaelRFairhurst self-assigned this Sep 18, 2024
@MichaelRFairhurst
Copy link
Contributor Author

It looks like we'll have the same false negative in the case of -Wformat=0. This will have to be addressed at the same time in order to satisfy CI/CD tests, as it appears our extractor mimic functionality translates -Wno-format to -Wformat=0, which we have to use in order to suppress the gcc default flag of -Wformat. Easy to fix both at the same time, however.

MichaelRFairhurst added a commit that referenced this issue Sep 18, 2024
The presence of -Wno-foo should not mark the compilation compliant with
A1-1-2, nor should the presence of -Wfoo=0.

Easily check for all -Wfoo=bar flags, that foo is not no-baz, and bar is
not 0. Also check there is no -Wno-foo flag overruling it. Otherwise the
query functionality remains the same.

Add test cases for non-compliant scenarios -Wfoo=0 and -Wno-foo, and for
the compliant scenario -Wall -Wno-foo.

This will have some compatibility issues with PR #688, after one is
merged the other will need some small updates before this can be merged.
MichaelRFairhurst added a commit that referenced this issue Oct 2, 2024
The presence of -Wno-foo should not mark the compilation compliant with
A1-1-2, nor should the presence of -Wfoo=0.

Easily check for all -Wfoo=bar flags, that foo is not no-baz, and bar is
not 0. Also check there is no -Wno-foo flag overruling it. Otherwise the
query functionality remains the same.

Add test cases for non-compliant scenarios -Wfoo=0 and -Wno-foo, and for
the compliant scenario -Wall -Wno-foo.

This will have some compatibility issues with PR #688, after one is
merged the other will need some small updates before this can be merged.
github-merge-queue bot pushed a commit that referenced this issue Oct 4, 2024
…ress-individual-warnings-flag

Fix #689, false negatives for A1-1-2 thinking -Wno-foo is compliant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR
Projects
Development

No branches or pull requests

2 participants