Skip to content
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

SLUDGE: Fix build with Clang >= 11.0.0 #3359

Merged
merged 1 commit into from Sep 10, 2021

Conversation

knobix
Copy link
Contributor

@knobix knobix commented Sep 10, 2021

Clang 11 and newer check the types of return values more strictly and
generate an error if there is a discrepancy.

However the "bool loadGame()" function, returns the value "NULL", if
loading of a savegame was unsucessful, whereas Clang expects a return
value of type "bool".

Remedy the issue by using "false" as return value instead of "NULL".

Clang 11 and newer check the types of return values more strictly and
generate an error if there is a discrepancy.

However the "bool loadGame()" function, returns the value "NULL", if
loading of a savegame was unsucessful, whereas Clang expects a return
value of type "bool".

Remedy the issue by using "false" as return value instead of "NULL".
@knobix
Copy link
Contributor Author

knobix commented Sep 10, 2021

On FreeBSD 13.0 (amd64 or i386), which has Clang 11.0.1, the build with --enable-all-engines for the pre-release 2.3.0 fails with following error:

engines/sludge/saveload.cpp:195:10: error: cannot initialize return object of type 'bool' with an rvalue of type 'nullptr_t'
                return NULL;
                       ^~~~
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
1 error generated.
gmake[2]: *** [Makefile.common:164: engines/sludge/saveload.o] Error 1

This issue does not appear with FreeBSD 11.4 and 12.2, which have Clang 10.0.0 and 10.0.1, respectively.

@bluegr
Copy link
Member

bluegr commented Sep 10, 2021

Nice catch, thanks! Merging

@bluegr bluegr merged commit 3101573 into scummvm:master Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants