1

We started seeing a lot of warnings like this after upgrading to Xcode 9.3:

Macro expansion producing 'defined' has undefined behavior

Like this:

#if MIXPANEL_FLUSH_IMMEDIATELY // ==> Warning: Macro expansion producing ...
    [self flush];
#endif

And this:

#if !MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT // ==> Warning: Macro expansion producing 
- (void)setValidationEnabled:(BOOL)validationEnabled {
    _validationEnabled = validationEnabled;
    ...
}
#endif
Yuchen
  • 30,852
  • 26
  • 164
  • 234

1 Answers1

5

I guess the Macro can't be nested in Xcode 9.3. I have these warnings too. SCENEKIT_SDK_AVAILABLE is a nested Macro

The Macro was defined like this, which cause the warnings:

#if TARGET_OS_MAC
    #define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT)
#elif TARGET_OS_IPHONE
    #define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT)
#endif

and I fixed it like this:

#if defined(POP_USE_SCENEKIT)
# define USE_SCENEKIT 1
#else
# define USE_SCENEKIT 0
#endif
#if TARGET_OS_MAC
    #define SCENEKIT_SDK_AVAILABLE USE_SCENEKIT
#elif TARGET_OS_IPHONE
    #define SCENEKIT_SDK_AVAILABLE USE_SCENEKIT
#endif

I seperated the Macro "SCENEKIT_SDK_AVAILABLE" like that, and the warnings were gone.

You can try my way.