-
Notifications
You must be signed in to change notification settings - Fork 487
Suppress -Wdirect-ivar-access in generated objcpp files #255
base: master
Are you sure you want to change the base?
Conversation
Automated message from Dropbox CLA bot @mknejp, it looks like you've already signed the Dropbox CLA. Thanks! |
What build settings does the affected project have? Is this warning turned on explicitly? |
The warning is turned on manually in a |
You can also add compile flags to individual files in a target in Xcode (though gyp can't do that). Hmm, I'm torn. It seems like there might be a slippery slope here, since we don't want the Djinni generator to have to be modified for lots of non-standard build flags which different people come up with. I suspect a change like this might be hard to maintain and subject to accidental breakage by Djinni devs who don't run with this warning enabled, and miss a case when changing or refactoring code. That being said, there's no risk of breaking anyone who doesn't have the flag enabled, so I can merge this. Two requests before I do:
|
751885a
to
3b14c7f
Compare
3b14c7f
to
fe052be
Compare
I almost forgot this was still open. Currently looking at this again. One thing though:
There's already |
@@ -138,6 +138,10 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) { | |||
val objcSelf = if (i.ext.objc && i.ext.cpp) self + "CppProxy" else self | |||
|
|||
if (i.ext.cpp) { | |||
// Disable warnings in Clang about directly accessing the ivars of an object | |||
w.wl("#if __clang__") | |||
w.wl("#pragma clang diagnostic ignored \"-Wdirect-ivar-access\"") |
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.
I would remove the w.wl("#if __clang__")
w.wl("#endif")
wrapping, else lgtm. We currently suppress the warning via an xcconfig file but having a more selective suppression would be really nice. Thanks for working on that!
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.
Suggested changes inline. The xcodeproj files also need merging with recent changes before this can be merged.
@@ -138,6 +138,10 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) { | |||
val objcSelf = if (i.ext.objc && i.ext.cpp) self + "CppProxy" else self | |||
|
|||
if (i.ext.cpp) { | |||
// Disable warnings in Clang about directly accessing the ivars of an object | |||
w.wl("#if __clang__") |
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.
Looks like the indentation of the new code here is mixing tabs and spaces. Can you standardize on spaces to match the existing code, please?
// Disable warnings in Clang about directly accessing the ivars of an object | ||
w.wl("#if __clang__") | ||
w.wl("#pragma clang diagnostic ignored \"-Wdirect-ivar-access\"") | ||
w.wl("#endif") |
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.
The generated code doesn't include the #if/#endif here, so I presume it wasn't regenerated after the most recent change? Please re-generate to reflect the latest state of the generator. After seeing the commentary I'm fine with merging this either with or without the #if.
We just added djinni generated files to an existing iOS project and it blessed us with about 200 new warnings. This adds
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
to.mm
files unless someone knows how to generate equally efficient code that doesn't trigger it.