Build fixes for GCC 13 and MinGW compilers #52
Merged
+36
−32
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.
This PR fixes two build issues I found while preparing new updated Solarus build images that support Qlementine.
Each of these is fixed on an individual commit for an easier review, but explanations are also provided below.
In GCC 13, a new dangling references warning was introduced. Qlementine has code that is triggering this warning and failing to build due to
-Werror
. This PR fixes the warnings-turned-errors by using intermediate assignments instead.The first commit in this PR fixes these dangling reference warnings.
The second build error is due to (incorrectly) using a
WIN32
user macro instead of the standard predefined_WIN32
compiler macro. When compiling with MSVC, it automatically adds the user defined macroWIN32
for backwards compatibility, but this is not the case for other compilers such as MinGW or Clang. Therefore, when compiling with these, the wrong code paths are chosen causing a missing symbol in the built library that then causes a linking error in client applications.The second commit replaces `WIN32` with `_WIN32` and fixes this linking error in client applications.
EDIT: I tried to run
clang-format
but it formatted more code than my own changes in this PR, therefore I think is better to run it outside of this particular PR to reduce diff noise.