unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27041: MacOS 10.6: fix NS build
@ 2017-05-23 18:57 Charles A. Roelli
  2017-05-23 19:49 ` Alan Third
       [not found] ` <handler.27041.D27041.149565262621210.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Charles A. Roelli @ 2017-05-23 18:57 UTC (permalink / raw)
  To: 27041

[-- Attachment #1: Type: text/plain, Size: 3780 bytes --]

Was getting these errors:

========
nsterm.h:455: error: expected ‘)’ before ‘instancetype’
nsterm.h:456: error: expected ‘)’ before ‘instancetype’
nsterm.h:460: error: expected ‘)’ before ‘instancetype’
nsterm.h:463: error: expected ‘)’ before ‘instancetype’
nsterm.h:523: error: expected ‘)’ before ‘instancetype’
nsterm.h:557: error: expected ‘)’ before ‘instancetype’
nsterm.h:592: error: expected ‘)’ before ‘instancetype’
nsterm.h:611: error: expected ‘)’ before ‘instancetype’
nsterm.h:659: error: expected ‘)’ before ‘instancetype’
nsterm.h:661: error: expected ‘)’ before ‘instancetype’
nsterm.h:663: error: expected ‘)’ before ‘instancetype’
nsterm.h:664: error: expected ‘)’ before ‘instancetype’
nsterm.h:703: error: expected ‘)’ before ‘instancetype’
nsterm.h:706: error: expected ‘)’ before ‘instancetype’
nsterm.h:710: error: expected ‘)’ before ‘instancetype’
nsterm.h:711: error: expected ‘)’ before ‘instancetype’
nsterm.h:712: error: expected ‘)’ before ‘instancetype’
nsterm.h:735: error: expected ‘)’ before ‘instancetype’
nsterm.m:6900: error: expected ‘)’ before ‘instancetype’
nsterm.m:7630: error: expected ‘)’ before ‘instancetype’
nsterm.m:7655: error: expected ‘)’ before ‘instancetype’
nsterm.m:7681: error: expected ‘)’ before ‘instancetype’
nsterm.m:7909: error: expected ‘)’ before ‘instancetype’
nsterm.m:8261: error: expected ‘)’ before ‘instancetype’
nsterm.m:8345: error: expected ‘)’ before ‘instancetype’
nsterm.m:8353: error: expected ‘)’ before ‘instancetype’
nsterm.m:8408: error: expected ‘)’ before ‘instancetype’
nsterm.m:8487: error: expected ‘)’ before ‘instancetype’
========

   CC       nsmenu.o
nsmenu.m:1496: error: expected ‘)’ before ‘NSWindowStyleMask’
nsmenu.m: In function ‘-[EmacsDialogPanel 
initWithContentRect:styleMask:backing:defer:]’:
nsmenu.m:1498: warning: conflicting types for 
‘-(id)initWithContentRect:(NSRect)contentRect styleMask:(id)aStyle 
backing:(NSBackingStoreType)backingType defer:(BOOL)flag’
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:264: 
warning: previous declaration of 
‘-(id)initWithContentRect:(NSRect)contentRect 
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType 
defer:(BOOL)flag’
nsmenu.m:1520: warning: assignment makes pointer from integer without a cast
nsmenu.m:1525: warning: passing argument 2 of 
‘initWithContentRect:styleMask:backing:defer:’ makes integer from 
pointer without a cast
========

This is with an LLVM/GCC that came with MacOS 10.6:

i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 
5658) (LLVM build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I've changed the source back to compile correctly (see patch).  It comes 
down to
removing the "instancetype" identifiers and reverting an 
NSWindowStyleMask to an
NSUInteger.

I also see this warning when compiling macfont.m:

macfont.m: In function ‘mac_font_shape_1’:
macfont.m:416: warning: ‘NSLayoutManager’ may not respond to 
‘-getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:’
macfont.m:416: warning: (Messages without a matching method signature
macfont.m:416: warning: will be assumed to return ‘id’ and accept
macfont.m:416: warning: ‘...’ as arguments.)

(some new arguments were added in the recent changes).  But this doesn't 
seem to affect functionality so I've left that change as is.



[-- Attachment #2: 0001-Fix-NS-build-in-MacOS-10.6.patch --]
[-- Type: text/x-patch, Size: 10228 bytes --]

From e588d3efad0cc410237a78c41af26eca6ca24318 Mon Sep 17 00:00:00 2001
From: Charles A. Roelli <charles@aurox.ch>
Date: Tue, 23 May 2017 20:52:56 +0200
Subject: [PATCH] Fix NS build in MacOS 10.6

---
 src/nsimage.m |    8 ++++----
 src/nsmenu.m  |   12 ++++++------
 src/nsterm.h  |   38 +++++++++++++++++++-------------------
 src/nsterm.m  |   20 ++++++++++----------
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/nsimage.m b/src/nsimage.m
index fb2322a..8c0cbd5 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -152,7 +152,7 @@ Updated by Christian Limpach (chris@nice.ch)
 
 @implementation EmacsImage
 
-+ (instancetype)allocInitFromFile: (Lisp_Object)file
++ allocInitFromFile: (Lisp_Object)file
 {
   NSImageRep *imgRep;
   Lisp_Object found;
@@ -197,7 +197,7 @@ - (void)dealloc
 
 /* Create image from monochrome bitmap. If both FG and BG are 0
    (black), set the background to white and make it transparent. */
-- (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
+- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
            fg: (unsigned long)fg bg: (unsigned long)bg
 {
   unsigned char *planes[5];
@@ -269,7 +269,7 @@ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
 }
 
 /* Set color for a bitmap image.  */
-- (instancetype)setXBMColor: (NSColor *)color
+- setXBMColor: (NSColor *)color
 {
   NSSize s = [self size];
   unsigned char *planes[5];
@@ -309,7 +309,7 @@ - (instancetype)setXBMColor: (NSColor *)color
 }
 
 
-- (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)height
+- initForXPMWithDepth: (int)depth width: (int)width height: (int)height
 {
   NSSize s = {width, height};
   int i;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 37a1a62..2847bc6 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -493,7 +493,7 @@
 @implementation EmacsMenu
 
 /* override designated initializer */
-- (instancetype)initWithTitle: (NSString *)title
+- initWithTitle: (NSString *)title
 {
   frame = 0;
   if ((self = [super initWithTitle: title]))
@@ -503,7 +503,7 @@ - (instancetype)initWithTitle: (NSString *)title
 
 
 /* used for top-level */
-- (instancetype)initWithTitle: (NSString *)title frame: (struct frame *)f
+- initWithTitle: (NSString *)title frame: (struct frame *)f
 {
   [self initWithTitle: title];
   frame = f;
@@ -1146,7 +1146,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
 
 @implementation EmacsToolbar
 
-- (instancetype)initForView: (EmacsView *)view withIdentifier: (NSString *)identifier
+- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier
 {
   NSTRACE ("[EmacsToolbar initForView: withIdentifier:]");
 
@@ -1302,7 +1302,7 @@ - (void)setVisible:(BOOL)shown
    display. */
 @implementation EmacsTooltip
 
-- (instancetype)init
+- init
 {
   NSColor *col = [NSColor colorWithCalibratedRed: 1.0 green: 1.0
                                             blue: 0.792 alpha: 0.95];
@@ -1493,7 +1493,7 @@ @implementation EmacsDialogPanel
 #define TEXTHEIGHT	20.0
 #define MINCELLWIDTH	90.0
 
-- (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowStyleMask)aStyle
+- initWithContentRect: (NSRect)contentRect styleMask: (NSUInteger)aStyle
               backing: (NSBackingStoreType)backingType defer: (BOOL)flag
 {
   NSSize spacing = {SPACER, SPACER};
@@ -1697,7 +1697,7 @@ - (void)clicked: sender
 }
 
 
-- (instancetype)initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ
+- initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ
 {
   Lisp_Object head;
   [super init];
diff --git a/src/nsterm.h b/src/nsterm.h
index 443a40e..63472f2 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -451,16 +451,16 @@
    }
 
 /* AppKit-side interface */
-- (instancetype)menuDown: (id)sender;
-- (instancetype)toolbarClicked: (id)item;
-- (instancetype)toggleToolbar: (id)sender;
+- menuDown: (id)sender;
+- toolbarClicked: (id)item;
+- toggleToolbar: (id)sender;
 - (void)keyDown: (NSEvent *)theEvent;
 - (void)mouseDown: (NSEvent *)theEvent;
 - (void)mouseUp: (NSEvent *)theEvent;
-- (instancetype)setMiniwindowImage: (BOOL)setMini;
+- setMiniwindowImage: (BOOL)setMini;
 
 /* Emacs-side interface */
-- (instancetype) initFrameFromEmacs: (struct frame *) f;
+- initFrameFromEmacs: (struct frame *) f;
 - (void) createToolbar: (struct frame *)f;
 - (void) setRows: (int) r andColumns: (int) c;
 - (void) setWindowClosing: (BOOL)closing;
@@ -520,7 +520,7 @@
   unsigned long keyEquivModMask;
 }
 
-- (instancetype)initWithTitle: (NSString *)title frame: (struct frame *)f;
+- initWithTitle: (NSString *)title frame: (struct frame *)f;
 - (void)setFrame: (struct frame *)f;
 - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
 - (NSString *)parseKeyEquiv: (const char *)key;
@@ -554,7 +554,7 @@
      NSArray *prevIdentifiers;
      unsigned long enablement, prevEnablement;
    }
-- (instancetype) initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
+- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
 - (void) clearActive;
 - (void) clearAll;
 - (BOOL) changed;
@@ -589,7 +589,7 @@
    Lisp_Object dialog_return;
    Lisp_Object *button_values;
    }
-- (instancetype)initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
+- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
 - (void)process_dialog: (Lisp_Object)list;
 - (void)addButton: (char *)str value: (int)tag row: (int)row;
 - (void)addString: (char *)str row: (int)row;
@@ -608,7 +608,7 @@
     NSTextField *textField;
     NSTimer *timer;
   }
-- (instancetype) init;
+- init;
 - (void) setText: (char *)text;
 - (void) showAtX: (int)x Y: (int)y for: (int)seconds;
 - (void) hide;
@@ -656,12 +656,12 @@
   NSColor *stippleMask;
   unsigned long xbm_fg;
 }
-+ (instancetype)allocInitFromFile: (Lisp_Object)file;
++ allocInitFromFile: (Lisp_Object)file;
 - (void)dealloc;
-- (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
+- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
                   fg: (unsigned long)fg bg: (unsigned long)bg;
-- (instancetype)setXBMColor: (NSColor *)color;
-- (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
+- setXBMColor: (NSColor *)color;
+- initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
 - (void)setPixmapData;
 - (unsigned long)getPixelAtX: (int)x Y: (int)y;
 - (void)setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r
@@ -700,16 +700,16 @@
    int em_whole;
    }
 
-- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
+- initFrame: (NSRect )r window: (Lisp_Object)win;
 - (void)setFrame: (NSRect)r;
 
-- (instancetype) setPosition: (int) position portion: (int) portion whole: (int) whole;
+- setPosition: (int) position portion: (int) portion whole: (int) whole;
 - (int) checkSamePosition: (int)position portion: (int)portion
                     whole: (int)whole;
 - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e;
-- (instancetype)repeatScroll: (NSTimer *)sender;
-- (instancetype)condemn;
-- (instancetype)reprieve;
+- repeatScroll: (NSTimer *)sender;
+- condemn;
+- reprieve;
 - (bool)judge;
 + (CGFloat)scrollerWidth;
 @end
@@ -732,7 +732,7 @@
   unsigned long maxChar, maxGlyph;
   long i, len;
 }
-- (instancetype)initWithCapacity: (unsigned long) c;
+- initWithCapacity: (unsigned long) c;
 - (void) setString: (NSString *)str font: (NSFont *)font;
 @end
 #endif	/* NS_IMPL_COCOA */
diff --git a/src/nsterm.m b/src/nsterm.m
index e69aa43..b0bb9ec 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6897,7 +6897,7 @@ This avoids an extra clear and redraw (flicker) at frame creation.  */
 }
 
 
-- (instancetype) initFrameFromEmacs: (struct frame *)f
+- initFrameFromEmacs: (struct frame *)f
 {
   NSRect r, wr;
   Lisp_Object tem;
@@ -7627,7 +7627,7 @@ - (void)mouseExited: (NSEvent *)theEvent
 }
 
 
-- (instancetype)menuDown: sender
+- menuDown: sender
 {
   NSTRACE ("[EmacsView menuDown:]");
   if (context_menu_value == -1)
@@ -7652,7 +7652,7 @@ - (EmacsToolbar *)toolbar
 
 
 /* this gets called on toolbar button click */
-- (instancetype)toolbarClicked: (id)item
+- toolbarClicked: (id)item
 {
   NSEvent *theEvent;
   int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS;
@@ -7678,7 +7678,7 @@ - (instancetype)toolbarClicked: (id)item
 }
 
 
-- (instancetype)toggleToolbar: (id)sender
+- toggleToolbar: (id)sender
 {
   NSTRACE ("[EmacsView toggleToolbar:]");
 
@@ -7906,7 +7906,7 @@ - (BOOL) writeSelectionToPasteboard: (NSPasteboard *)pb types: (NSArray *)types
    (gives a miniaturized version of the window); currently we use the latter for
    frames whose active buffer doesn't correspond to any file
    (e.g., '*scratch*') */
-- (instancetype)setMiniwindowImage: (BOOL) setMini
+- setMiniwindowImage: (BOOL) setMini
 {
   id image = [[self window] miniwindowImage];
   NSTRACE ("[EmacsView setMiniwindowImage:%d]", setMini);
@@ -8258,7 +8258,7 @@ + (CGFloat) scrollerWidth
   return r;
 }
 
-- (instancetype)initFrame: (NSRect )r window: (Lisp_Object)nwin
+- initFrame: (NSRect )r window: (Lisp_Object)nwin
 {
   NSTRACE ("[EmacsScroller initFrame: window:]");
 
@@ -8342,7 +8342,7 @@ - (void)dealloc
 }
 
 
-- (instancetype)condemn
+- condemn
 {
   NSTRACE ("[EmacsScroller condemn]");
   condemned =YES;
@@ -8350,7 +8350,7 @@ - (instancetype)condemn
 }
 
 
-- (instancetype)reprieve
+- reprieve
 {
   NSTRACE ("[EmacsScroller reprieve]");
   condemned =NO;
@@ -8405,7 +8405,7 @@ - (int) checkSamePosition: (int) position portion: (int) portion
 }
 
 
-- (instancetype)setPosition: (int)position portion: (int)portion whole: (int)whole
+- setPosition: (int)position portion: (int)portion whole: (int)whole
 {
   NSTRACE ("[EmacsScroller setPosition:portion:whole:]");
 
@@ -8484,7 +8484,7 @@ - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
 
 
 /* called manually thru timer to implement repeated button action w/hold-down */
-- (instancetype)repeatScroll: (NSTimer *)scrollEntry
+- repeatScroll: (NSTimer *)scrollEntry
 {
   NSEvent *e = [[self window] currentEvent];
   NSPoint p =  [[self window] mouseLocationOutsideOfEventStream];
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-26 19:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 18:57 bug#27041: MacOS 10.6: fix NS build Charles A. Roelli
2017-05-23 19:49 ` Alan Third
2017-05-24 18:13   ` Charles A. Roelli
2017-05-24 19:03     ` Alan Third
     [not found] ` <handler.27041.D27041.149565262621210.notifdone@debbugs.gnu.org>
2017-05-25  2:17   ` npostavs
2017-05-25 18:46     ` bug#27041: [PATCH] Check if instancetype supported in ObjC Alan Third
2017-05-25 23:42       ` npostavs
2017-05-26 19:25       ` Charles A. Roelli

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).