Subject: Re: bug#27059: Can't compile master branch on Mac OS X

From: David Caldwell <[email-masked]>
Date: Fri, 26 May 2017 10:23:32 -0700

On 5/25/17 12:02 PM, Alan Third wrote:
> On Thu, May 25, 2017 at 09:25:47AM -0700, David Caldwell wrote:
>> That didn't work, neither did the current HEAD. The current HEAD is
>> missing the backslash after the defined (NS_IMPL_GNUSTEP), for one
>> thing. But testing against MAC_OS_X_VERSION_10_10 doesn't work on older
>> OSes, it needs to be the hardcoded value '101000' (since the define
>> didn't exist back then). To sum up, this is the patch that worked for me:
> 
> Please try the attached patch. It should be a neater solution
> (checking whether the compiler supports instancetype directly).
> 
> If MAC_OS_X_VERSION_10_10 doesn’t exist we can define it ourselves, we
> already do this with the other versions that have specific
> requirements (top of nsterm.h). I evidently forgot to check whether we
> need to define it before committing the change.
> 
> Not that it matters now, this patch should work without it.

I tried the patch out, still has problems (this output is from Mac OS 10.9):

  CC       nsmenu.o
nsmenu.m:1496:70: error: expected a type
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle
                                                                     ^
nsmenu.m:1520:10: warning: incompatible integer to pointer conversion
assigning to 'id' from 'int' [-Wint-conversion]
  aStyle =
NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
         ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nsmenu.m:1524:54: warning: incompatible pointer to integer conversion
sending 'id' to parameter of type 'NSUInteger' (aka 'unsigned long')
[-Wint-conversion]
  [super initWithContentRect: contentRect styleMask: aStyle
                                                     ^~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:301:69:
note: passing argument to parameter 'aStyle' here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                                    ^
nsmenu.m:1496:88: warning: conflicting parameter types in implementation
of 'initWithContentRect:styleMask:backing:defer:': 'NSUInteger' (aka
'unsigned long') vs 'id' [-Wmismatched-parameter-types]
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle

              ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:301:69:
note: previous definition is here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                         ~~~~~~~~~~ ^
3 warnings and 1 error generated.
make: *** [nsmenu.o] Error 1