all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 01/13] Nextstep: Use instancetype explicit return type
@ 2017-05-20 14:58 Philipp Stephani
  2017-05-20 14:58 ` [PATCH 02/13] Declare Nextstep unexec functions in lisp.h Philipp Stephani
                   ` (13 more replies)
  0 siblings, 14 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

This removes compiler warnings on macOS and improves type safety.

* nsterm.m (initFrameFromEmacs:):
(menuDown:):
(toolbarClicked:):
(toggleToolbar:):
(setMiniwindowImage:):
(initFrame:window:):
(condemn, reprieve, setPosition:portion:whole:):
(repeatScroll:):
* nsmenu.m (initWithTitle:):
(initWithTitle:frame:):
(initForView:withIdentifier:):
(init, initWithContentRect:styleMask:backing:defer:):
(initFromContents:isQuestion:):
* nsimage.m (allocInitFromFile:):
(initFromXBM:width:height:fg:bg:):
(setXBMColor:):
(initForXPMWithDepth:width:height:): Use instancetype as return
type instead of implicit id.
---
 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 e87da77ccf..1c82fa780a 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -152,7 +152,7 @@ Updated by Christian Limpach (chris@nice.ch)
 
 @implementation EmacsImage
 
-+ allocInitFromFile: (Lisp_Object)file
++ (instancetype)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. */
-- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
+- (instancetype)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 @@ - (void)dealloc
 }
 
 /* Set color for a bitmap image.  */
-- setXBMColor: (NSColor *)color
+- (instancetype)setXBMColor: (NSColor *)color
 {
   NSSize s = [self size];
   unsigned char *planes[5];
@@ -309,7 +309,7 @@ - (void)dealloc
 }
 
 
-- initForXPMWithDepth: (int)depth width: (int)width height: (int)height
+- (instancetype)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 8dc6ea1d34..5e863bb17d 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -493,7 +493,7 @@
 @implementation EmacsMenu
 
 /* override designated initializer */
-- initWithTitle: (NSString *)title
+- (instancetype)initWithTitle: (NSString *)title
 {
   frame = 0;
   if ((self = [super initWithTitle: title]))
@@ -503,7 +503,7 @@ @implementation EmacsMenu
 
 
 /* used for top-level */
-- initWithTitle: (NSString *)title frame: (struct frame *)f
+- (instancetype)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
 
-- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier
+- (instancetype)initForView: (EmacsView *)view withIdentifier: (NSString *)identifier
 {
   NSTRACE ("[EmacsToolbar initForView: withIdentifier:]");
 
@@ -1302,7 +1302,7 @@ - (void)setVisible:(BOOL)shown
    display. */
 @implementation EmacsTooltip
 
-- init
+- (instancetype)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
 
-- initWithContentRect: (NSRect)contentRect styleMask: (NSUInteger)aStyle
+- (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowStyleMask)aStyle
               backing: (NSBackingStoreType)backingType defer: (BOOL)flag
 {
   NSSize spacing = {SPACER, SPACER};
@@ -1697,7 +1697,7 @@ - (void)clicked: sender
 }
 
 
-- initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ
+- (instancetype)initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ
 {
   Lisp_Object head;
   [super init];
diff --git a/src/nsterm.h b/src/nsterm.h
index 9285178d19..f9887d0515 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -444,16 +444,16 @@ char const * nstrace_fullscreen_type_name (int);
    }
 
 /* AppKit-side interface */
-- menuDown: (id)sender;
-- toolbarClicked: (id)item;
-- toggleToolbar: (id)sender;
+- (instancetype)menuDown: (id)sender;
+- (instancetype)toolbarClicked: (id)item;
+- (instancetype)toggleToolbar: (id)sender;
 - (void)keyDown: (NSEvent *)theEvent;
 - (void)mouseDown: (NSEvent *)theEvent;
 - (void)mouseUp: (NSEvent *)theEvent;
-- setMiniwindowImage: (BOOL)setMini;
+- (instancetype)setMiniwindowImage: (BOOL)setMini;
 
 /* Emacs-side interface */
-- initFrameFromEmacs: (struct frame *) f;
+- (instancetype) initFrameFromEmacs: (struct frame *) f;
 - (void) createToolbar: (struct frame *)f;
 - (void) setRows: (int) r andColumns: (int) c;
 - (void) setWindowClosing: (BOOL)closing;
@@ -513,7 +513,7 @@ char const * nstrace_fullscreen_type_name (int);
   unsigned long keyEquivModMask;
 }
 
-- initWithTitle: (NSString *)title frame: (struct frame *)f;
+- (instancetype)initWithTitle: (NSString *)title frame: (struct frame *)f;
 - (void)setFrame: (struct frame *)f;
 - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
 - (NSString *)parseKeyEquiv: (const char *)key;
@@ -547,7 +547,7 @@ char const * nstrace_fullscreen_type_name (int);
      NSArray *prevIdentifiers;
      unsigned long enablement, prevEnablement;
    }
-- initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
+- (instancetype) initForView: (EmacsView *)view withIdentifier: (NSString *)identifier;
 - (void) clearActive;
 - (void) clearAll;
 - (BOOL) changed;
@@ -582,7 +582,7 @@ char const * nstrace_fullscreen_type_name (int);
    Lisp_Object dialog_return;
    Lisp_Object *button_values;
    }
-- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
+- (instancetype)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;
@@ -601,7 +601,7 @@ char const * nstrace_fullscreen_type_name (int);
     NSTextField *textField;
     NSTimer *timer;
   }
-- init;
+- (instancetype) init;
 - (void) setText: (char *)text;
 - (void) showAtX: (int)x Y: (int)y for: (int)seconds;
 - (void) hide;
@@ -649,12 +649,12 @@ char const * nstrace_fullscreen_type_name (int);
   NSColor *stippleMask;
   unsigned long xbm_fg;
 }
-+ allocInitFromFile: (Lisp_Object)file;
++ (instancetype)allocInitFromFile: (Lisp_Object)file;
 - (void)dealloc;
-- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
+- (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
                   fg: (unsigned long)fg bg: (unsigned long)bg;
-- setXBMColor: (NSColor *)color;
-- initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
+- (instancetype)setXBMColor: (NSColor *)color;
+- (instancetype)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
@@ -693,16 +693,16 @@ char const * nstrace_fullscreen_type_name (int);
    int em_whole;
    }
 
-- initFrame: (NSRect )r window: (Lisp_Object)win;
+- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
 - (void)setFrame: (NSRect)r;
 
-- setPosition: (int) position portion: (int) portion whole: (int) whole;
+- (instancetype) 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;
-- repeatScroll: (NSTimer *)sender;
-- condemn;
-- reprieve;
+- (instancetype)repeatScroll: (NSTimer *)sender;
+- (instancetype)condemn;
+- (instancetype)reprieve;
 - (bool)judge;
 + (CGFloat)scrollerWidth;
 @end
@@ -725,7 +725,7 @@ char const * nstrace_fullscreen_type_name (int);
   unsigned long maxChar, maxGlyph;
   long i, len;
 }
-- initWithCapacity: (unsigned long) c;
+- (instancetype)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 c22c5a70ba..107635f034 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6896,7 +6896,7 @@ This avoids an extra clear and redraw (flicker) at frame creation.  */
 }
 
 
-- initFrameFromEmacs: (struct frame *)f
+- (instancetype) initFrameFromEmacs: (struct frame *)f
 {
   NSRect r, wr;
   Lisp_Object tem;
@@ -7626,7 +7626,7 @@ - (void)mouseExited: (NSEvent *)theEvent
 }
 
 
-- menuDown: sender
+- (instancetype)menuDown: sender
 {
   NSTRACE ("[EmacsView menuDown:]");
   if (context_menu_value == -1)
@@ -7651,7 +7651,7 @@ - (EmacsToolbar *)toolbar
 
 
 /* this gets called on toolbar button click */
-- toolbarClicked: (id)item
+- (instancetype)toolbarClicked: (id)item
 {
   NSEvent *theEvent;
   int idx = [item tag] * TOOL_BAR_ITEM_NSLOTS;
@@ -7677,7 +7677,7 @@ - (EmacsToolbar *)toolbar
 }
 
 
-- toggleToolbar: (id)sender
+- (instancetype)toggleToolbar: (id)sender
 {
   NSTRACE ("[EmacsView toggleToolbar:]");
 
@@ -7905,7 +7905,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*') */
-- setMiniwindowImage: (BOOL) setMini
+- (instancetype)setMiniwindowImage: (BOOL) setMini
 {
   id image = [[self window] miniwindowImage];
   NSTRACE ("[EmacsView setMiniwindowImage:%d]", setMini);
@@ -8257,7 +8257,7 @@ + (CGFloat) scrollerWidth
   return r;
 }
 
-- initFrame: (NSRect )r window: (Lisp_Object)nwin
+- (instancetype)initFrame: (NSRect )r window: (Lisp_Object)nwin
 {
   NSTRACE ("[EmacsScroller initFrame: window:]");
 
@@ -8341,7 +8341,7 @@ - (void)dealloc
 }
 
 
-- condemn
+- (instancetype)condemn
 {
   NSTRACE ("[EmacsScroller condemn]");
   condemned =YES;
@@ -8349,7 +8349,7 @@ - (void)dealloc
 }
 
 
-- reprieve
+- (instancetype)reprieve
 {
   NSTRACE ("[EmacsScroller reprieve]");
   condemned =NO;
@@ -8404,7 +8404,7 @@ - (int) checkSamePosition: (int) position portion: (int) portion
 }
 
 
-- setPosition: (int)position portion: (int)portion whole: (int)whole
+- (instancetype)setPosition: (int)position portion: (int)portion whole: (int)whole
 {
   NSTRACE ("[EmacsScroller setPosition:portion:whole:]");
 
@@ -8483,7 +8483,7 @@ - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e
 
 
 /* called manually thru timer to implement repeated button action w/hold-down */
-- repeatScroll: (NSTimer *)scrollEntry
+- (instancetype)repeatScroll: (NSTimer *)scrollEntry
 {
   NSEvent *e = [[self window] currentEvent];
   NSPoint p =  [[self window] mouseLocationOutsideOfEventStream];
-- 
2.13.0




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

* [PATCH 02/13] Declare Nextstep unexec functions in lisp.h
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 03/13] Remove unused function print_regions Philipp Stephani
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

This removes compiler warnings about missing prototypes on macOS.
---
 src/emacs.c | 4 ----
 src/lisp.h  | 8 ++++++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 3aa914f22f..4477f5bc01 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -137,10 +137,6 @@ static
 bool might_dump;
 #endif
 
-#if defined DARWIN_OS && !defined CANNOT_DUMP
-extern void unexec_init_emacs_zone (void);
-#endif
-
 /* If true, Emacs should not attempt to use a window-specific code,
    but instead should use the virtual terminal under which it was started.  */
 bool inhibit_window_system;
diff --git a/src/lisp.h b/src/lisp.h
index ec8a8b1c09..f423a66d5a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3887,6 +3887,14 @@ extern void get_backtrace (Lisp_Object array);
 Lisp_Object backtrace_top_function (void);
 extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol);
 
+/* Defined in unexmacosx.c.  */
+#if defined DARWIN_OS && !defined CANNOT_DUMP
+extern void unexec_init_emacs_zone (void);
+extern void *unexec_malloc (size_t);
+extern void *unexec_realloc (void *, size_t);
+extern void unexec_free (void *);
+#endif
+
 #include "emacs-module.h"
 
 /* Function prototype for the module Lisp functions.  */
-- 
2.13.0




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

* [PATCH 03/13] Remove unused function print_regions
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
  2017-05-20 14:58 ` [PATCH 02/13] Declare Nextstep unexec functions in lisp.h Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection Philipp Stephani
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

---
 src/unexmacosx.c | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 97dcb435d3..3b1efa3ca3 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -346,31 +346,6 @@ print_region_list (void)
     print_region (r->address, r->size, r->protection, r->max_protection);
 }
 
-static void
-print_regions (void)
-{
-  task_t target_task = mach_task_self ();
-  vm_address_t address = (vm_address_t) 0;
-  vm_size_t size;
-  struct vm_region_basic_info info;
-  mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT;
-  mach_port_t object_name;
-
-  printf ("   address     size prot maxp\n");
-
-  while (vm_region (target_task, &address, &size, VM_REGION_BASIC_INFO,
-		    (vm_region_info_t) &info, &info_count, &object_name)
-	 == KERN_SUCCESS && info_count == VM_REGION_BASIC_INFO_COUNT)
-    {
-      print_region (address, size, info.protection, info.max_protection);
-
-      if (object_name != MACH_PORT_NULL)
-	mach_port_deallocate (target_task, object_name);
-
-      address += size;
-    }
-}
-
 /* Build the list of regions that need to be dumped.  Regions with
    addresses above VM_DATA_TOP are omitted.  Adjacent regions with
    identical protection are merged.  Note that non-writable regions
-- 
2.13.0




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

* [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
  2017-05-20 14:58 ` [PATCH 02/13] Declare Nextstep unexec functions in lisp.h Philipp Stephani
  2017-05-20 14:58 ` [PATCH 03/13] Remove unused function print_regions Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 05/13] Make a function static that isn't used outside this file Philipp Stephani
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

This should not cause behavior changes, but fixes a compiler warning
due to implicit conversions between the enums.

* src/macfont.m (macfont_cache, macfont_lookup_cache)
(macfont_get_glyph_for_cid, macfont_get_uvs_table)
(macfont_variation_glyphs): Use NSCharacterCollection.
---
 src/macfont.m | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/macfont.m b/src/macfont.m
index f356842db1..b859eb4378 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -206,7 +206,7 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
 
 #if !USE_CT_GLYPH_INFO
 static CGGlyph
-mac_font_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection,
+mac_font_get_glyph_for_cid (CTFontRef font, NSCharacterCollection collection,
                             CGFontIndex cid)
 {
   CGGlyph result = kCGFontIndexInvalid;
@@ -1321,8 +1321,8 @@ equal to the number of rows that are invalid as BMP (i.e., from
     /* Character collection specifying the destination of the mapping
        provided by `table' above.  If `table' is obtained from the UVS
        subtable in the font cmap table, then the value of this member
-       should be kCTCharacterCollectionIdentityMapping.  */
-    CTCharacterCollection collection;
+       should be NSIdentityMappingCharacterCollection.  */
+    NSCharacterCollection collection;
   } uvs;
 };
 
@@ -1333,8 +1333,8 @@ equal to the number of rows that are invalid as BMP (i.e., from
 static CFCharacterSetRef macfont_get_cf_charset_for_name (CFStringRef);
 static CGGlyph macfont_get_glyph_for_character (struct font *, UTF32Char);
 static CGGlyph macfont_get_glyph_for_cid (struct font *font,
-                                          CTCharacterCollection, CGFontIndex);
-static CFDataRef macfont_get_uvs_table (struct font *, CTCharacterCollection *);
+                                          NSCharacterCollection, CGFontIndex);
+static CFDataRef macfont_get_uvs_table (struct font *, NSCharacterCollection *);
 
 static struct macfont_cache *
 macfont_lookup_cache (CFStringRef key)
@@ -1582,7 +1582,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
 }
 
 static CGGlyph
-macfont_get_glyph_for_cid (struct font *font, CTCharacterCollection collection,
+macfont_get_glyph_for_cid (struct font *font, NSCharacterCollection collection,
                            CGFontIndex cid)
 {
   struct macfont_info *macfont_info = (struct macfont_info *) font;
@@ -1593,7 +1593,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
 }
 
 static CFDataRef
-macfont_get_uvs_table (struct font *font, CTCharacterCollection *collection)
+macfont_get_uvs_table (struct font *font, NSCharacterCollection *collection)
 {
   struct macfont_info *macfont_info = (struct macfont_info *) font;
   CTFontRef macfont = macfont_info->macfont;
@@ -1603,12 +1603,12 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
   if (cache->uvs.table == NULL)
     {
       CFDataRef uvs_table = mac_font_copy_uvs_table (macfont);
-      CTCharacterCollection uvs_collection =
-        kCTCharacterCollectionIdentityMapping;
+      NSCharacterCollection uvs_collection =
+        NSIdentityMappingCharacterCollection;
 
       if (uvs_table == NULL
           && mac_font_get_glyph_for_cid (macfont,
-                                         kCTCharacterCollectionAdobeJapan1,
+                                         NSAdobeJapan1CharacterCollection,
                                          6480) != kCGFontIndexInvalid)
         {
           /* If the glyph for U+4E55 is accessible via its CID 6480,
@@ -1625,7 +1625,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
           if (mac_uvs_table_adobe_japan1)
             {
               uvs_table = CFRetain (mac_uvs_table_adobe_japan1);
-              uvs_collection = kCTCharacterCollectionAdobeJapan1;
+              uvs_collection = NSAdobeJapan1CharacterCollection;
             }
         }
       if (uvs_table == NULL)
@@ -3348,7 +3348,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
 macfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
 {
   CFDataRef uvs_table;
-  CTCharacterCollection uvs_collection;
+  NSCharacterCollection uvs_collection;
   int i, n = 0;
 
   block_input ();
@@ -3368,7 +3368,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
         {
           CGGlyph glyph = glyphs[i];
 
-          if (uvs_collection != kCTCharacterCollectionIdentityMapping
+          if (uvs_collection != NSIdentityMappingCharacterCollection
               && glyph != kCGFontIndexInvalid)
             glyph = macfont_get_glyph_for_cid (font, uvs_collection, glyph);
           if (glyph == kCGFontIndexInvalid)
-- 
2.13.0




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

* [PATCH 05/13] Make a function static that isn't used outside this file
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (2 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 06/13] Remove calls to deprecated setUsesScreenFonts Philipp Stephani
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/kqueue.c (kqueue_directory_listing): Make static.
---
 src/kqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kqueue.c b/src/kqueue.c
index 8e6b1e149f..a8eb4cb797 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -42,7 +42,7 @@ static Lisp_Object watch_list;
 
 /* Generate a list from the directory_files_internal output.
    Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE).  */
-Lisp_Object
+static Lisp_Object
 kqueue_directory_listing (Lisp_Object directory_files)
 {
   Lisp_Object dl, result = Qnil;
-- 
2.13.0




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

* [PATCH 06/13] Remove calls to deprecated setUsesScreenFonts
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (3 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 05/13] Make a function static that isn't used outside this file Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 07/13] Remove trailing semicolons in method definitions Philipp Stephani
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/macfont.m (mac_screen_font_get_metrics): Don't call setUsesScreenFonts.
(mac_font_shape_1): Remove screen_font_p parameter.
(mac_screen_font_shape): Remove screen_font_p argument.
---
 src/macfont.m | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/macfont.m b/src/macfont.m
index b859eb4378..dccb4e6fd0 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -284,7 +284,6 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
 
   [textStorage setFont:nsFont];
   [textContainer setLineFragmentPadding:0];
-  [layoutManager setUsesScreenFonts:YES];
 
   [layoutManager addTextContainer:textContainer];
   [textContainer release];
@@ -318,8 +317,7 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
 
 static CFIndex
 mac_font_shape_1 (NSFont *font, NSString *string,
-                  struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len,
-                  BOOL screen_font_p)
+                  struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len)
 {
   NSUInteger i;
   CFIndex result = 0;
@@ -339,7 +337,6 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
                                           initWithString:@" "] autorelease])];
   [textStorage setFont:font];
   [textContainer setLineFragmentPadding:0];
-  [layoutManager setUsesScreenFonts:screen_font_p];
 
   [layoutManager addTextContainer:textContainer];
   [textContainer release];
@@ -587,7 +584,7 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
 {
   return mac_font_shape_1 ([(NSFont *)font printerFont],
                            (NSString *) string,
-                           glyph_layouts, glyph_len, YES);
+                           glyph_layouts, glyph_len);
 }
 
 static CGColorRef
-- 
2.13.0




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

* [PATCH 07/13] Remove trailing semicolons in method definitions
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (4 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 06/13] Remove calls to deprecated setUsesScreenFonts Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 08/13] Nextstep: remove some deprecated method calls Philipp Stephani
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

These semicolons are ignored and cause compiler warnings.

* src/nsimage.m (setPixelAtX:Y:toRed:green:blue:alpha:):
* src/nsterm.m (init, updateFrameSize:):
(setFrame:): Remove trailing semicolon.
---
 src/nsimage.m | 2 +-
 src/nsterm.m  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/nsimage.m b/src/nsimage.m
index 1c82fa780a..fb2322afc3 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -386,7 +386,7 @@ - (unsigned long) getPixelAtX: (int)x Y: (int)y
 
 - (void) setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r
                green: (unsigned char)g blue: (unsigned char)b
-               alpha:(unsigned char)a;
+               alpha:(unsigned char)a
 {
   if (bmRep == nil)
     return;
diff --git a/src/nsterm.m b/src/nsterm.m
index 107635f034..9ba1dc0fa2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1317,7 +1317,7 @@ - (void)remove;
 
 @implementation EmacsBell
 
-- (id)init;
+- (id)init
 {
   NSTRACE ("[EmacsBell init]");
   if ((self = [super init]))
@@ -6529,7 +6529,7 @@ - (BOOL)windowShouldClose: (id)sender
   return NO;
 }
 
-- (void) updateFrameSize: (BOOL) delay;
+- (void) updateFrameSize: (BOOL) delay
 {
   NSWindow *window = [self window];
   NSRect wr = [window frame];
@@ -6847,7 +6847,7 @@ - (void)windowWillMiniaturize: sender
 }
 
 
-- (void)setFrame:(NSRect)frameRect;
+- (void)setFrame:(NSRect)frameRect
 {
   NSTRACE ("[EmacsView setFrame:" NSTRACE_FMT_RECT "]",
            NSTRACE_ARG_RECT (frameRect));
-- 
2.13.0




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

* [PATCH 08/13] Nextstep: remove some deprecated method calls
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (5 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 07/13] Remove trailing semicolons in method definitions Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 09/13] Nextstep: Replace deprecated enumerators Philipp Stephani
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/nsterm.m (mouseDown:):
* src/nsmenu.m (runMenuAt:forFrame:keymaps:): Remove call to
deprecated method.  The return value is always nil.
* src/macfont.m (mac_font_shape_1): Replace call to deprecated method.
---
 src/macfont.m | 5 +++--
 src/nsmenu.m  | 2 +-
 src/nsterm.m  | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/macfont.m b/src/macfont.m
index dccb4e6fd0..be8153390d 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -410,8 +410,9 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
       /* For now we assume the direction is not changed within the
          string.  */
       [layoutManager getGlyphsInRange:(NSMakeRange (glyphIndex, 1))
-                               glyphs:NULL characterIndexes:NULL
-                    glyphInscriptions:NULL elasticBits:NULL
+                               glyphs:NULL
+                           properties:NULL
+                     characterIndexes:NULL
                            bidiLevels:&bidiLevel];
       if (bidiLevel & 1)
         permutation = xmalloc (sizeof (NSUInteger) * used);
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 5e863bb17d..8dcbe194d5 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -750,7 +750,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
                          modifierFlags: 0
                              timestamp: [e timestamp]
                           windowNumber: [[view window] windowNumber]
-                               context: [e context]
+                               context: nil
                            eventNumber: 0/*[e eventNumber] */
                             clickCount: 1
                               pressure: 0];
diff --git a/src/nsterm.m b/src/nsterm.m
index 9ba1dc0fa2..a734d0f86e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8602,7 +8602,7 @@ - (void)mouseDown: (NSEvent *)e
                                  modifierFlags: [e modifierFlags]
                                      timestamp: [e timestamp]
                                   windowNumber: [e windowNumber]
-                                       context: [e context]
+                                       context: nil
                                    eventNumber: [e eventNumber]
                                     clickCount: [e clickCount]
                                       pressure: [e pressure]];
-- 
2.13.0




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

* [PATCH 09/13] Nextstep: Replace deprecated enumerators
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (6 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 08/13] Nextstep: remove some deprecated method calls Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 10/13] Remove unused automatic variables Philipp Stephani
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/nsmenu.m (initWithContentRect:styleMask:backing:defer:): Replace
deprecated enumerator.
---
 src/nsmenu.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 8dcbe194d5..37a1a62d6d 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1517,7 +1517,7 @@ - (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowSty
   [img autorelease];
   [imgView autorelease];
 
-  aStyle = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSUtilityWindowMask;
+  aStyle = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
   flag = YES;
   rows = 0;
   cols = 1;
-- 
2.13.0




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

* [PATCH 10/13] Remove unused automatic variables
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (7 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 09/13] Nextstep: Replace deprecated enumerators Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 11/13] Clean up code around 'ns-list-services' Philipp Stephani
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* nsterm.m (ns_read_socket):
* macfont.m (macfont_open): Remove unused automatic variables.
---
 src/macfont.m | 3 +--
 src/nsterm.m  | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/macfont.m b/src/macfont.m
index be8153390d..4d310e47ae 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2536,8 +2536,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
   int size;
   CTFontRef macfont;
   CTFontSymbolicTraits sym_traits;
-  char name[256];
-  int len, i, total_width;
+  int i, total_width;
   CGGlyph glyph;
   CGFloat ascent, descent, leading;
 
diff --git a/src/nsterm.m b/src/nsterm.m
index a734d0f86e..0667ebb45b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4247,7 +4247,6 @@ in certain situations (rapid incoming events).
         }
       else
         {
-          ptrdiff_t specpdl_count = SPECPDL_INDEX ();
           /* Run and wait for events.  We must always send one NX_APPDEFINED event
              to ourself, otherwise [NXApp run] will never exit.  */
           send_appdefined = YES;
-- 
2.13.0




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

* [PATCH 11/13] Clean up code around 'ns-list-services'
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (8 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 10/13] Remove unused automatic variables Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 12/13] Fix call of registerServicesMenuSendTypes Philipp Stephani
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/nsfns.m (Fns_list_services): Remove unreachable code.  In this
branch NS_IMPL_COCOA cannot be defined.
(interpret_services_menu): Define only if called to avoid compiler
warnings about unused static functions.
---
 src/nsfns.m | 32 ++------------------------------
 1 file changed, 2 insertions(+), 30 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index cbe0ffb858..31b2f762e0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -175,6 +175,7 @@ Updated by Christian Limpach (chris@nice.ch)
 #endif
 }
 
+#ifndef NS_IMPL_COCOA
 static Lisp_Object
 interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old)
 /* --------------------------------------------------------------------------
@@ -223,7 +224,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
     }
   return old;
 }
-
+#endif
 
 
 /* ==========================================================================
@@ -2107,9 +2108,6 @@ and GNUstep implementations ("distributor-specific release
 #else
   Lisp_Object ret = Qnil;
   NSMenu *svcs;
-#ifdef NS_IMPL_COCOA
-  id delegate;
-#endif
 
   check_window_system (NULL);
   svcs = [[NSMenu alloc] initWithTitle: @"Services"];
@@ -2117,33 +2115,7 @@ and GNUstep implementations ("distributor-specific release
   [NSApp registerServicesMenuSendTypes: ns_send_types
                            returnTypes: ns_return_types];
 
-/* On Tiger, services menu updating was made lazier (waits for user to
-   actually click on the menu), so we have to force things along: */
-#ifdef NS_IMPL_COCOA
-  delegate = [svcs delegate];
-  if (delegate != nil)
-    {
-      if ([delegate respondsToSelector: @selector (menuNeedsUpdate:)])
-        [delegate menuNeedsUpdate: svcs];
-      if ([delegate respondsToSelector:
-                       @selector (menu:updateItem:atIndex:shouldCancel:)])
-        {
-          int i, len = [delegate numberOfItemsInMenu: svcs];
-          for (i =0; i<len; i++)
-            [svcs addItemWithTitle: @"" action: NULL keyEquivalent: @""];
-          for (i =0; i<len; i++)
-            if (![delegate menu: svcs
-                     updateItem: (NSMenuItem *)[svcs itemAtIndex: i]
-                        atIndex: i shouldCancel: NO])
-              break;
-        }
-    }
-#endif
-
   [svcs setAutoenablesItems: NO];
-#ifdef NS_IMPL_COCOA
-  [svcs update]; /* on macOS, converts from '/' structure */
-#endif
 
   ret = interpret_services_menu (svcs, Qnil, ret);
   return ret;
-- 
2.13.0




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

* [PATCH 12/13] Fix call of registerServicesMenuSendTypes
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (9 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 11/13] Clean up code around 'ns-list-services' Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-20 14:58 ` [PATCH 13/13] Avoid uninitialized read Philipp Stephani
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/nsterm.m (initFrameFromEmacs:): nil is not allowed for
returnTypes; pass an empty array instead.
---
 src/nsterm.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 0667ebb45b..27c5792800 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7022,7 +7022,7 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
   [self allocateGState];
 #endif
   [NSApp registerServicesMenuSendTypes: ns_send_types
-                           returnTypes: nil];
+                           returnTypes: [NSArray array]];
 
   /* macOS Sierra automatically enables tabbed windows.  We can't
      allow this to be enabled until it's available on a Free system.
-- 
2.13.0




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

* [PATCH 13/13] Avoid uninitialized read
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (10 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 12/13] Fix call of registerServicesMenuSendTypes Philipp Stephani
@ 2017-05-20 14:58 ` Philipp Stephani
  2017-05-21 15:30   ` John Wiegley
  2017-05-20 20:23 ` [PATCH 01/13] Nextstep: Use instancetype explicit return type Paul Eggert
  2017-05-22  2:36 ` Paul Eggert
  13 siblings, 1 reply; 20+ messages in thread
From: Philipp Stephani @ 2017-05-20 14:58 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* src/nsterm.m (ns_read_socket): Don't read uninitialized variable 'nevents'.
---
 src/nsterm.m | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/nsterm.m b/src/nsterm.m
index 27c5792800..33d053363f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4261,6 +4261,8 @@ in certain situations (rapid incoming events).
       q_event_ptr = NULL;
       unblock_input ();
     }
+  else
+    return -1;
 
   return nevents;
 }
-- 
2.13.0




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

* Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (11 preceding siblings ...)
  2017-05-20 14:58 ` [PATCH 13/13] Avoid uninitialized read Philipp Stephani
@ 2017-05-20 20:23 ` Paul Eggert
  2017-05-20 22:45   ` mituharu
  2017-05-21 20:00   ` Philipp Stephani
  2017-05-22  2:36 ` Paul Eggert
  13 siblings, 2 replies; 20+ messages in thread
From: Paul Eggert @ 2017-05-20 20:23 UTC (permalink / raw)
  To: Philipp Stephani, emacs-devel; +Cc: Philipp Stephani

Thanks. These patches all look good; please commit. For routine stuff like this 
you might consider saving us all some time and just committing it.



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

* Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type
  2017-05-20 20:23 ` [PATCH 01/13] Nextstep: Use instancetype explicit return type Paul Eggert
@ 2017-05-20 22:45   ` mituharu
  2017-05-21 20:00   ` Philipp Stephani
  1 sibling, 0 replies; 20+ messages in thread
From: mituharu @ 2017-05-20 22:45 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: Philipp Stephani, emacs-devel

For macfont stuffs, you might want to look at how the original
code in the Mac port deals with these warnings (especially,
without losing the "screen font" feature, and without breaking
older versions).

https://bitbucket.org/mituharu/emacs-mac/src/df85af37ecb76855ffb9f85285e2111c612775af/src/?at=master

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





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

* Re: [PATCH 13/13] Avoid uninitialized read
  2017-05-20 14:58 ` [PATCH 13/13] Avoid uninitialized read Philipp Stephani
@ 2017-05-21 15:30   ` John Wiegley
  0 siblings, 0 replies; 20+ messages in thread
From: John Wiegley @ 2017-05-21 15:30 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: emacs-devel

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

>>>>> "PS" == Philipp Stephani <phst@google.com> writes:

PS> * src/nsterm.m (ns_read_socket): Don't read uninitialized variable
PS> 'nevents'.

Thank you for all of these ns cleanups, Philipp!

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

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

* Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type
  2017-05-20 20:23 ` [PATCH 01/13] Nextstep: Use instancetype explicit return type Paul Eggert
  2017-05-20 22:45   ` mituharu
@ 2017-05-21 20:00   ` Philipp Stephani
  1 sibling, 0 replies; 20+ messages in thread
From: Philipp Stephani @ 2017-05-21 20:00 UTC (permalink / raw)
  To: Paul Eggert, emacs-devel; +Cc: Philipp Stephani

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

Paul Eggert <eggert@cs.ucla.edu> schrieb am Sa., 20. Mai 2017 um 22:23 Uhr:

> Thanks. These patches all look good; please commit. For routine stuff like
> this
> you might consider saving us all some time and just committing it.
>

Sure, will do.

[-- Attachment #2: Type: text/html, Size: 521 bytes --]

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

* Re: [PATCH 01/13] Nextstep: Use instancetype explicit return type
  2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
                   ` (12 preceding siblings ...)
  2017-05-20 20:23 ` [PATCH 01/13] Nextstep: Use instancetype explicit return type Paul Eggert
@ 2017-05-22  2:36 ` Paul Eggert
  2017-05-22 19:21   ` [PATCH] Fix GNUstep build Alan Third
  13 siblings, 1 reply; 20+ messages in thread
From: Paul Eggert @ 2017-05-22  2:36 UTC (permalink / raw)
  To: Philipp Stephani, emacs-devel
  Cc: Philipp Stephani, Alan Third, Anders Lindgren

Oops, I spoke too quickly. This patch breaks the build on Ubuntu 16.04.2 LTS 
x86-64, with the following being the first symptom:

In file included from nsterm.m:48:0:
nsterm.h: At top level:
nsterm.h:447:4: error: unknown type name ‘instancetype’
  - (instancetype)menuDown: (id)sender;
     ^

Is that something you can fix? We need the Nextstep port to work with GNUstep as 
well as with macOS.

Looking backward, I see that even before the recent patches the build was 
already broken on Ubuntu 16.04.2 LTS, as follows:

nsfns.m: In function ‘Fns_set_mouse_absolute_pixel_position’:
nsfns.m:3101:3: error: unknown type name ‘CGPoint’
    CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y);
    ^

Still, we shouldn't make things worse. I'll CC: this to Alan Third and Anders 
Lindgren to see whether they can advise.



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

* [PATCH] Fix GNUstep build
  2017-05-22  2:36 ` Paul Eggert
@ 2017-05-22 19:21   ` Alan Third
  2017-05-23  9:46     ` Paul Eggert
  0 siblings, 1 reply; 20+ messages in thread
From: Alan Third @ 2017-05-22 19:21 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Philipp Stephani, Anders Lindgren, emacs-devel

* src/nsterm.h [NS_IMPL_GNUSTEP]: Add typedefs for Cocoa-only types.
(NSWindowStyleMaskUtilityWindow): #define to NSUtilityWindowMask in
GNUstep and old versions of macOS.
* src/nsfns.m (ns-set-mouse-absolute-pixel-position): Function only
works in cocoa, not GNUstep.
---
 src/nsfns.m  | 4 ++++
 src/nsterm.h | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/nsfns.m b/src/nsfns.m
index 00310c051f..3833ee75ac 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3046,6 +3046,9 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
 \(0, 0) of the selected frame's display.  */)
        (Lisp_Object x, Lisp_Object y)
 {
+#ifdef NS_IMPL_COCOA
+  /* GNUstep doesn't support CGWarpMouseCursorPosition, so none of
+     this will work. */
   struct frame *f = SELECTED_FRAME ();
   EmacsView *view = FRAME_NS_VIEW (f);
   NSScreen *screen = [[view window] screen];
@@ -3072,6 +3075,7 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
 
   CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y);
   CGWarpMouseCursorPosition (mouse_pos);
+#endif /* NS_IMPL_COCOA */
 
   return Qnil;
 }
diff --git a/src/nsterm.h b/src/nsterm.h
index 5da949e1fb..443a40ed6f 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -62,6 +62,13 @@ typedef CGFloat EmacsCGFloat;
 typedef float EmacsCGFloat;
 #endif
 
+/* FIXME: It looks as though instancetype will be supported in GNUstep
+   at some point, but I'm not sure what version. */
+#ifdef NS_IMPL_GNUSTEP
+typedef id instancetype;
+typedef int NSWindowStyleMask;
+#endif
+
 /* ==========================================================================
 
    Trace support
@@ -1290,6 +1297,7 @@ extern char gnustep_base_version[];  /* version tracking */
 #define NSWindowStyleMaskMiniaturizable    NSMiniaturizableWindowMask
 #define NSWindowStyleMaskResizable         NSResizableWindowMask
 #define NSWindowStyleMaskTitled            NSTitledWindowMask
+#define NSWindowStyleMaskUtilityWindow     NSUtilityWindowMask
 #define NSAlertStyleCritical               NSCriticalAlertStyle
 #define NSControlSizeRegular               NSRegularControlSize
 #endif
-- 

I think this should do the trick.

-- 
Alan Third



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

* Re: [PATCH] Fix GNUstep build
  2017-05-22 19:21   ` [PATCH] Fix GNUstep build Alan Third
@ 2017-05-23  9:46     ` Paul Eggert
  0 siblings, 0 replies; 20+ messages in thread
From: Paul Eggert @ 2017-05-23  9:46 UTC (permalink / raw)
  To: Alan Third; +Cc: Philipp Stephani, Anders Lindgren, emacs-devel

Thanks, that patch unbroke the build for me on Ubuntu 16.04.2, so I installed it 
into master in your name.



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

end of thread, other threads:[~2017-05-23  9:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-20 14:58 [PATCH 01/13] Nextstep: Use instancetype explicit return type Philipp Stephani
2017-05-20 14:58 ` [PATCH 02/13] Declare Nextstep unexec functions in lisp.h Philipp Stephani
2017-05-20 14:58 ` [PATCH 03/13] Remove unused function print_regions Philipp Stephani
2017-05-20 14:58 ` [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection Philipp Stephani
2017-05-20 14:58 ` [PATCH 05/13] Make a function static that isn't used outside this file Philipp Stephani
2017-05-20 14:58 ` [PATCH 06/13] Remove calls to deprecated setUsesScreenFonts Philipp Stephani
2017-05-20 14:58 ` [PATCH 07/13] Remove trailing semicolons in method definitions Philipp Stephani
2017-05-20 14:58 ` [PATCH 08/13] Nextstep: remove some deprecated method calls Philipp Stephani
2017-05-20 14:58 ` [PATCH 09/13] Nextstep: Replace deprecated enumerators Philipp Stephani
2017-05-20 14:58 ` [PATCH 10/13] Remove unused automatic variables Philipp Stephani
2017-05-20 14:58 ` [PATCH 11/13] Clean up code around 'ns-list-services' Philipp Stephani
2017-05-20 14:58 ` [PATCH 12/13] Fix call of registerServicesMenuSendTypes Philipp Stephani
2017-05-20 14:58 ` [PATCH 13/13] Avoid uninitialized read Philipp Stephani
2017-05-21 15:30   ` John Wiegley
2017-05-20 20:23 ` [PATCH 01/13] Nextstep: Use instancetype explicit return type Paul Eggert
2017-05-20 22:45   ` mituharu
2017-05-21 20:00   ` Philipp Stephani
2017-05-22  2:36 ` Paul Eggert
2017-05-22 19:21   ` [PATCH] Fix GNUstep build Alan Third
2017-05-23  9:46     ` Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.