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

[3.2] [iOS] Fix compilation warnings and deprecated API #42459

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Oct 1, 2020

Fixes #29800 for 3.2
Deprecation and errors in 4.0 has already been addressed with Vulkan implementation.

Most of the code changes duplicate the same changes made in 4.0. There is no major deletions of previous/deprecated functionality, which I plan to do in followup PRs to make 3.2 file/code structure more like 4.0 to make it easier for future iOS PRs to be cherry-picked.

I've also reenabled werror for iOS GitHub workflow.
Increased deployment target in iOS template to 10.0, since 3.2 Godot is built for 10.0 version anyway.

#41173 (which fixes #41058 for 3.2) could conflict with this PR, but shouldn't be anything major.

@@ -301,6 +304,7 @@ - (void)setControllerInputHandler:(GCController *)controller {
OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_R2, jx);
};
};
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code be removed instead of commented out?

And what about the following #ifdef ADD_MICRO_GAMEPAD which references being disabled by default due to not having API 9? I guess it's an outdated comment, but does this code work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's currently commented out at 4.0, so I've decided to keep it. Will delete it after rebase.
As for ADD_MICRO_GAMEPAD Godot is already built for SDK 10, so it should be safe to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that nothing defines ADD_MICRO_GAMEPAD currently, so this code might require testing to validate it before enabling it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've noticed that. While compilation seems to be working, I can't really test micro (?) gamepad as I don't have one.

@akien-mga
Copy link
Member

#41173 (which fixes #41058 for 3.2) could conflict with this PR, but shouldn't be anything major.

I just merged it, so a rebase will be needed.

@@ -189,11 +192,9 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran
int sdk_version = 6;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need ancient code for iOS 7?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need it, but it's still exists in 4.0. And I planned to remove it later PRs to keep this PR as simple as possible. I'll remove it required. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to build it using iOS 7 target? If it's not (with is definitely the case for 4.0) there's no reason to keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Godot uses -miphoneos-version-min=10.0 so it's not. I'll change the code then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if you want to keep this PR a simple backport of master changes, and then make two new PRs for further deprecation fixes for master and 3.2, that's fine with me. The comments made here can be used as actionable feedback for this follow-up PR.

Copy link
Contributor Author

@naithar naithar Oct 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that should work better. But I'll rebase and remove some commented parts, as they wouldn't affect anything anyway.

@naithar
Copy link
Contributor Author

naithar commented Oct 1, 2020

iOS getting ./core/math/octree_definition.inc:689:46: error: ambiguous expansion of macro 'ABS' [-Werror,-Wambiguous-macro,1] error.
For some reason I don't get it on my computer

@akien-mga
Copy link
Member

akien-mga commented Oct 1, 2020

There are also conflicts with MIN and MAX, all taken from /Applications/Xcode_11.7.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h

But I don't remember seeing those in the past either in build logs.

For ./core/math/octree_definition.inc, it was added recently via #41123. Maybe it needs to use Math::abs instead of ABS? But several other core classes use ABS so not sure why it's an issue with octree.

@naithar
Copy link
Contributor Author

naithar commented Oct 1, 2020

Managed to get this error after rebasing again. Still not sure what caused it.

@bruvzg
Copy link
Member

bruvzg commented Oct 1, 2020

I'm getting it without this PR too, so it's not related. Using following command (same as CI)
scons -j2 verbose=yes warnings=all werror=no platform=iphone target=release tools=no

All definitions in SDK have ifndef ABS (MAX/MIN), it's probably issue with included order (Godot math header is included after system one and redefine it). and Godot header also have ifndef ABS, that's strange.

@naithar
Copy link
Contributor Author

naithar commented Oct 1, 2020

Also got:

[  6%] Compiling ==> platform/iphone/os_iphone.mm
In file included from platform/iphone/os_iphone.mm:40:
In file included from ./servers/visual/rasterizer.h:35:
In file included from ./servers/visual_server.h:36:
In file included from ./core/math/geometry.h:34:
./core/math/delaunay.h:108:21: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro,1]

Moving system headers at os_iphone.mm to top before #include "os_iphone.h" seems to be fixing this issue. But I'm not sure why this problem hadn't occurred before.

The other strange thing is that this issue hadn't occurred in master branch

// System headers are at top
// to workaround `ambiguous expansion` warning/error
#import <UIKit/UIKit.h>
#include <dlfcn.h>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily moved to top to check if it helps.

@naithar
Copy link
Contributor Author

naithar commented Oct 1, 2020

Seems like it can also be solved by -Wno-ambiguous-macro, but I'm not sure that it's better, then keeping system header at top.

Found this: https://sqlite.org/forum/forumpost/6d0e24a98e, not sure if it's related, but looks like it.

@naithar
Copy link
Contributor Author

naithar commented Oct 1, 2020

@akien-mga linux build failure seems to be unrelated to this PR:

ERROR: get_language_code: Invalid locale 'C'.
87
   At: core/translation.cpp:945.
88
ERROR: set_locale: Unsupported locale 'C', falling back to 'en'.
89
   At: core/translation.cpp:969.

Change deprecated method calls to new ones.
Guard iOS version dependant functionality behind availability checks.
@akien-mga akien-mga merged commit dbb1df2 into godotengine:3.2 Oct 1, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants