all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: David Caldwell <david@porkrind.org>
Cc: Philipp Stephani <p.stephani2@gmail.com>, 27059@debbugs.gnu.org
Subject: bug#27059: Can't compile master branch on Mac OS X
Date: Thu, 25 May 2017 20:02:20 +0100	[thread overview]
Message-ID: <20170525190220.GA3197@breton.holly.idiocy.org> (raw)
In-Reply-To: <2b432643-7cfb-fa05-6b08-97bfc1da9d2b@porkrind.org>

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

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.

-- 
Alan Third

[-- Attachment #2: 0001-Check-if-instancetype-supported-in-ObjC.patch --]
[-- Type: text/plain, Size: 2862 bytes --]

From 94b5820b8e71ef5a2692f2515ff376b65ce8434b Mon Sep 17 00:00:00 2001
In-Reply-To: <87shjt65o7.fsf_-_@users.sourceforge.net>
References: <87shjt65o7.fsf_-_@users.sourceforge.net>
From: Alan Third <alan@idiocy.org>
Date: Thu, 25 May 2017 19:23:39 +0100
Subject: [PATCH] Check if instancetype supported in ObjC
To: npostavs@users.sourceforge.net
Cc: 27041@debbugs.gnu.org, "Charles A. Roelli" <charles@aurox.ch>

* configure.ac: Add check for instancetype.
* src/nsterm.h [!NATIVE_OBJC_INSTANCETYPE]: Define instancetype.
---
 configure.ac | 17 +++++++++++++++++
 src/nsterm.h | 20 +++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d23b5d214..b525666a85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1980,6 +1980,23 @@ AC_DEFUN
 AC_SUBST(NS_OBJ)
 AC_SUBST(NS_OBJC_OBJ)
 
+AC_CACHE_CHECK(
+  [if the Objective C compiler supports instancetype],
+  [emacs_cv_objc_instancetype],
+  [AC_LANG_PUSH([Objective C])
+   AC_COMPILE_IFELSE(
+     [AC_LANG_SOURCE([[@interface Test
+                        + (instancetype)test;
+                        @end]])],
+     emacs_cv_objc_instancetype=yes,
+     emacs_cv_objc_instancetype=no)
+   AC_LANG_POP([Objective C])])
+
+if test x$emacs_cv_objc_instancetype = xyes ; then
+  AC_DEFINE(NATIVE_OBJC_INSTANCETYPE, 1,
+            [Define if ObjC compiler supports instancetype natively.])
+fi
+
 HAVE_W32=no
 W32_OBJ=
 W32_LIBS=
diff --git a/src/nsterm.h b/src/nsterm.h
index 8f3d92b353..f75e3759e4 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -62,15 +62,6 @@ typedef CGFloat EmacsCGFloat;
 typedef float EmacsCGFloat;
 #endif
 
-/* FIXME: instancetype is a language built-in, but older versions of
-   Clang don't support it, and I don't know if GCC supports it at all.
-   Should this be tested for in ./configure? */
-#if defined (NS_IMPL_GNUSTEP)
-    || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
-typedef id instancetype;
-typedef NSUInteger NSWindowStyleMask;
-#endif
-
 /* ==========================================================================
 
    Trace support
@@ -365,6 +356,12 @@ char const * nstrace_fullscreen_type_name (int);
 #endif
 
 
+/* If the compiler doesn't support instancetype, map it to id. */
+#ifndef NATIVE_OBJC_INSTANCETYPE
+typedef id instancetype;
+#endif
+
+
 /* ==========================================================================
 
    NSColor, EmacsColor category.
@@ -1302,6 +1299,11 @@ extern char gnustep_base_version[];  /* version tracking */
 #define NSWindowStyleMaskUtilityWindow     NSUtilityWindowMask
 #define NSAlertStyleCritical               NSCriticalAlertStyle
 #define NSControlSizeRegular               NSRegularControlSize
+
+/* And adds NSWindowStyleMask. */
+#ifdef __OBJC__
+typedef NSUInteger NSWindowStyleMask;
+#endif
 #endif
 
 #endif	/* HAVE_NS */
-- 
2.12.0


  reply	other threads:[~2017-05-25 19:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 16:22 bug#27059: Can't compile master branch on Mac OS X David Caldwell
2017-05-24 20:20 ` Philipp Stephani
2017-05-25 16:25   ` David Caldwell
2017-05-25 19:02     ` Alan Third [this message]
2017-05-26 17:23       ` David Caldwell
2017-05-26 18:47         ` Philipp Stephani
2017-05-26 19:30         ` David Caldwell
2017-05-26 23:58           ` Alan Third
2017-05-29  6:55             ` David Caldwell
2017-05-29  8:24               ` Alan Third
2017-05-29  8:56                 ` David Caldwell
2017-05-29 16:05                   ` Alan Third
2017-05-30 18:36                     ` David Caldwell
2017-05-30 19:01                       ` Alan Third
2017-05-31 23:39                         ` David Caldwell
2017-05-25 21:12 ` OKAZAKI Tetsurou

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=20170525190220.GA3197@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=27059@debbugs.gnu.org \
    --cc=david@porkrind.org \
    --cc=p.stephani2@gmail.com \
    /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.