all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Po Lu <luangruo@yahoo.com>
Cc: "Mattias Engdegård" <mattiase@acm.org>,
	"Keith David Bershatsky" <esq@lawlist.com>,
	"Paul Eggert" <eggert@cs.ucla.edu>,
	emacs-devel@gnu.org
Subject: Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat'
Date: Tue, 19 Apr 2022 05:19:10 +0100	[thread overview]
Message-ID: <Yl44PtHO6ZPwku0c@idiocy.org> (raw)
In-Reply-To: <87zgkhg5qd.fsf@yahoo.com>

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

On Tue, Apr 19, 2022 at 10:35:38AM +0800, Po Lu wrote:
> Keith David Bershatsky <esq@lawlist.com> writes:
> 
> > I located just one instance of 1060 and changed it to 1068 per your
> > suggestion.  The build generated one warning during the nsterm.m
> > section, and then moved on to nsfns.m, where the build stopped.
> 
> I think you meant nsmenu.m.
> 
> >   CC       nsmenu.o
> > In file included from nsmenu.m:28:
> > lisp.h:2156: warning: declaration does not declare anything
> > nsmenu.m: In function '-[EmacsMenu fillWithWidgetValue:]':
> > nsmenu.m:652: error: stray '@' in program
> > nsmenu.m:652: error: field name not in record or union initializer
> > nsmenu.m:652: error: (near initialization for 'font_attribs')
> > nsmenu.m:652: warning: incompatible Objective-C types initializing 'struct NSFont *', expected 'struct NSDictionary *'
> 
> I don't know what "@" means in Objective-C, and it seems that GCC
> doesn't support such a feature.  Would someone please explain this piece
> of code?
> 
>   NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};

Welcome to the wonderful world of Objective C under GCC.

The attached should fix this particular error.

These problems will need to be fixed in the emacs-28 branch, assuming
we're going to continue supporting macOS 10.6.

FWIW, I've moved away from trying to hide warnings generated on older
versions of macOS to try and avoid the difficult to understand #if
constructions we've previously used throughout the code.
-- 
Alan Third

[-- Attachment #2: 0001-Fix-nsmenu-compilation-under-macOS-10.6.patch --]
[-- Type: text/x-diff, Size: 1827 bytes --]

From f11340a5a5d234b57022908483979dfa0a9ccb99 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 19 Apr 2022 05:05:17 +0100
Subject: [PATCH] Fix nsmenu compilation under macOS 10.6

* src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): Replace modern
shorthand dictionary and array definitions.
---
 src/nsmenu.m | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 81d7cd2da1..0f7d1fb98f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -649,7 +649,8 @@ - (void)fillWithWidgetValue: (void *)wvptr
      work around it by using tabs to split the title into two
      columns.  */
   NSFont *menuFont = [NSFont menuFontOfSize:0];
-  NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};
+  NSDictionary *font_attribs = [NSDictionary dictionaryWithObjectsAndKeys:
+                                               menuFont, NSFontAttributeName, nil];
   CGFloat maxNameWidth = 0;
   CGFloat maxKeyWidth = 0;
 
@@ -677,11 +678,12 @@ - (void)fillWithWidgetValue: (void *)wvptr
   NSTextTab *tab =
     [[[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight
                                      location: maxWidth
-                                      options: @{}] autorelease];
+                                      options: [NSDictionary dictionary]] autorelease];
   NSMutableParagraphStyle *pstyle = [[[NSMutableParagraphStyle alloc] init]
                                       autorelease];
-  [pstyle setTabStops: @[tab]];
-  attributes = @{NSParagraphStyleAttributeName: pstyle};
+  [pstyle setTabStops: [NSArray arrayWithObject:tab]];
+  attributes = [NSDictionary dictionaryWithObjectsAndKeys:
+                               pstyle, NSParagraphStyleAttributeName, nil];
 #endif
 
   /* clear existing contents */
-- 
2.35.1


  reply	other threads:[~2022-04-19  4:19 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  1:24 Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat' Keith David Bershatsky
2022-04-19  2:35 ` Po Lu
2022-04-19  4:19   ` Alan Third [this message]
2022-04-19  4:24     ` Po Lu
2022-04-19  6:04     ` Eli Zaretskii
2022-04-20  1:23     ` Po Lu
2022-04-20  8:07       ` Alan Third
2022-04-19  2:56 ` Paul Eggert
  -- strict thread matches above, loose matches on Subject: below --
2022-04-26  2:56 Keith David Bershatsky
2022-04-26  3:14 ` Po Lu
2022-04-25  5:17 Keith David Bershatsky
2022-04-25  5:43 ` Po Lu
2022-04-25  9:56   ` Alan Third
2022-04-25 10:30     ` Po Lu
2022-04-25 18:07       ` Alan Third
2022-04-26  0:10         ` Po Lu
2022-04-25  3:46 Keith David Bershatsky
2022-04-25  4:13 ` Po Lu
2022-04-25  1:49 Keith David Bershatsky
2022-04-25  3:09 ` Po Lu
2022-04-25  1:35 Keith David Bershatsky
2022-04-25 18:08 ` Alan Third
2022-04-24 17:02 Keith David Bershatsky
2022-04-24 19:22 ` Alan Third
2022-04-24  0:08 Keith David Bershatsky
2022-04-24  9:03 ` Alan Third
2022-04-23  4:33 Keith David Bershatsky
2022-04-23 22:04 ` Alan Third
2022-04-22 21:29 Keith David Bershatsky
2022-04-23 22:13 ` Alan Third
2022-04-22 21:23 Keith David Bershatsky
2022-04-21 22:40 Keith David Bershatsky
2022-04-21 22:44 ` Alan Third
2022-04-21 20:51 Keith David Bershatsky
2022-04-21 22:22 ` Alan Third
2022-04-21 17:52 Keith David Bershatsky
2022-04-21 19:21 ` Alan Third
2022-04-21  2:22 Keith David Bershatsky
2022-04-21  0:51 Keith David Bershatsky
2022-04-21  2:05 ` Po Lu
2022-04-21  5:09 ` Alan Third
2022-04-20 13:55 Keith David Bershatsky
2022-04-20 16:48 ` Alan Third
2022-04-19  4:36 Keith David Bershatsky
2022-04-19  4:38 ` Po Lu
2022-04-18 20:43 Keith David Bershatsky
2022-04-18 19:51 Keith David Bershatsky
2022-04-18 19:54 ` Paul Eggert
2022-04-19  1:00 ` Po Lu
2022-04-18  2:24 Keith David Bershatsky
2022-04-18  2:53 ` Po Lu
2022-04-18  0:38 Keith David Bershatsky
2022-04-18  0:58 ` Paul Eggert
2022-04-18  1:39 ` Po Lu
2022-04-17 21:57 Keith David Bershatsky
2022-04-17 23:21 ` Paul Eggert
2022-04-17 18:45 Keith David Bershatsky
2022-04-17 20:37 ` Alan Third
2022-04-17 20:37 ` Paul Eggert
2022-04-15 19:11 Keith David Bershatsky
2022-04-17  9:01 ` Mattias Engdegård
2022-04-17 17:49   ` Paul Eggert
2022-04-17 19:12     ` Eli Zaretskii
2022-04-17 20:36       ` Paul Eggert
2022-04-18  4:49         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yl44PtHO6ZPwku0c@idiocy.org \
    --to=alan@idiocy.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    --cc=luangruo@yahoo.com \
    --cc=mattiase@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.