-
Notifications
You must be signed in to change notification settings - Fork 251
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
Resolve 3301 compiler warnings #645
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scripts/Y2K.cpp:467:5: warning: deleting object of polymorphic class type "LevelScript_0000" which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] 467 | delete ((LevelScript_0000 *)ptr);
Devirtualization is an optimization in the generated assembly: when a class C is polymorphic but also final, ``((C *)ptr)->func()`` can be turned from an indirect into a static call.
Some classes did set it to nullptr and others did not. For the sake of consistency, initialize it explicitly everywhere.
scripts/LEVEL0.cpp:1036:27: warning: unused variable "event_data" [-Wunused-variable] and a lot more.
jengelh
force-pushed
the
master
branch
3 times, most recently
from
November 4, 2024 10:58
cbaacef
to
9ba0037
Compare
sebholt
reviewed
Nov 4, 2024
Descent3/multi_dll_mgr.cpp:974:43: warning: deleting "void*" is undefined [-Wdelete-incomplete] (``delete`` requires that types are _complete_, so as to find the right destructor to call; ``void`` is incomplete by definition.)
Lgt2x
approved these changes
Nov 26, 2024
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.
Thanks for taking the time to solve warnings, that's very appreciated. Splitting in multiple commits will help if we ever need to revert something that unexpectedly causes mayhem. In the meantime, I did not see any change that could be a problem. Runtime is fine too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Description
Compiler warnings point out qualitative issues with the code. gcc emits roughly 3860 warnings on Linux-amd64.
This batch addresses the top two categories,
Checklist