-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Mark deprecated overrides as deprecated #3520
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
C++: Mark deprecated overrides as deprecated #3520
Conversation
The QL compiler is about to be changed to emit a warning when overriding a deprecated predicate. This PR marks the existing overrides of deprecated predicates as `deprecated` themselves, which avoids the warning. The `Print.qll` models seem to preserve the `isWideCharDefault()` predicate for backwards compatibility, so we can't remove them and must continue overriding them. The `XML.qll` override is necessary because both superclasses declare the `getName()` predicate. One is `deprecated`, and the other is `abstract`, so we have to have an override.
Does this mean that uses of |
Actually, |
👍 This sounds like a great time to remove those long-deprecated member predicates on |
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.
These changes are simpler than I'd expecteded.
isWideCharDefault
changes LGTM.
I'm not so happy with deprecating XMLFile.getName()
. If it disambiguates between deprecated
and a non-deprecated
parent class predicates I would expect it to inherit non-deprecated
status. Seems like a bug that this is being flagged?
I'm happy with removing File.getName()
as a solution, but this does trigger a chain reaction of removing other predicates from File.qll
. Perhaps that's not a bad thing.
Thanks for the suggestion. I have discussed this with my team and changed the PR to only report the warning when all overridden members are deprecated. |
I've undone the change to |
@geoffw0 Is it OK to merge, then? |
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.
LGTM.
In a near-future release overriding a deprecated predicate without making as deprecated would give a compiler warning. Not fixing the XML one. [I can see that this shouldn't be reported anymore](github#3520 (comment)), and it's not safe to remove since it was only marked as deprecated in e6425bb.
Fixes github/codeql-c-analysis-team#79
The QL compiler is about to be changed to emit a warning when overriding a deprecated predicate. This PR marks the existing overrides of deprecated predicates as
deprecated
themselves, which avoids the warning.The
Print.qll
models seem to preserve theisWideCharDefault()
predicate for backwards compatibility, so we can't remove them and must continue overriding them.The
XML.qll
override is necessary because both superclasses declare thegetName()
predicate. One isdeprecated
, and the other isabstract
, so we have to have an override.