-
Notifications
You must be signed in to change notification settings - Fork 64
Banned: Simplify alert messages, address compiler compat issues #225
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
Conversation
The macros in tgmath.h often expand to other macros in tgmath.h. This cause the query to report multiple macro violations for the one macro invocation. We exclude macro invocations expanded from other macro invocations from the same file to avoid this double reporting, and produce more useful and stable results across compilers.
🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results. |
🤖 Beep Boop! gcc/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! clang/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! gcc/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! clang/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing! |
Do not report macro invocations inside other macro invocations where the parent macro invocation is also for a macro inside fenv.h.
These queries report macro invocations for standard library macros which are defined with different argument names depending on the compiler.
These queries report macro invocations for standard library macros which are defined with different argument names depending on the compiler.
🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results. |
Addressed the issues reported by the matrix testing - primarily adding compiler specific expected results files for queries reporting macro invocations of macros in the standard library that may have different argument names. I have also modified one more query (21-12) to not report nested macro invocations, to make the output stable between compilers and to improve user experience. The matrix testing report also tested 21-1, even though I haven't changed that rule. I am not planning to address that issue in this PR. |
🤖 Beep Boop! clang/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! gcc/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! gcc/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! clang/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing! |
setjmp encompasses the arguments on real compilers, due to differences in how the macros are defined.
🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results. |
🤖 Beep Boop! clang/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! gcc/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test! |
🤖 Beep Boop! clang/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! gcc/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!
|
🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
The "Banned" queries frequently used an alert message that included a link to the element declaration in the standard headers. For example, Rule 21.10 had the following select clause:
However, on most "real" codebases the standard library headers are outside the source directory. This means that the path given to this link is absolute path on the machine, and subsequently Code Scanning would display no source code for it.
Referencing a standard library header also causes our compiler testing to encounter compatibility issues, because e.g. clang and gcc will have different standard library paths.
I have addressed this by removing the links to standard library headers from all the banned queries.
In addition, I have:
@rvermeulen @s-samadi I think you were involved in writing these queries, if either of you want to review this!
Change request type
.ql
,.qll
,.qls
or unit tests)Rules with added or modified queries
Rule 21.4
Rule 21.5
Rule 21.6
Rule 21.7
Rule 21.8
Rule 21.9
Rule 21.10
Rule 21.11
Rule 21.12
Rule 21.21
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.