SCUMM: Fix build with UBSan and SCUMM engine disabled#6372
Merged
bluegr merged 2 commits intoscummvm:masterfrom Dec 28, 2024
Merged
SCUMM: Fix build with UBSan and SCUMM engine disabled#6372bluegr merged 2 commits intoscummvm:masterfrom
bluegr merged 2 commits intoscummvm:masterfrom
Conversation
It's used by detection code and avoids including scumm.h in the detection code.
This creates a specific translation unit for the code making use of ScummEngine while keeping file.cpp for the classes needed for the detection code. This allows to build with UBSan while the Scumm engine is disabled.
Member
|
Nice work! This cleanly separates the file related code used for detection |
This file contains hidden or 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
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.
When building with the Undefined Behaviour Sanitizer (UBSan) and the SCUMM engine disabled, the linker fails to find the ScummEngine typeinfo needed by the UBSan instrumentation code in file.cpp.
That's because several classes in file.cpp need a pointer to a ScummEngine object and UBSan tries to check their type at runtime.
This code is not used in the detection code and could be cleaned up by the linker before resolving the references but that's not done in this order.
So, to avoid problems, I split the classes in another file which is only built with the engine and not the detection code.
In addition, I move the debug flags in detection.h to avoid including scumm.h in the detection code.
That was that or adding a declaration for the ScummFile class in scumm.h.