From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Charles A. Roelli" Newsgroups: gmane.emacs.bugs Subject: bug#27041: [PATCH] Check if instancetype supported in ObjC Date: Fri, 26 May 2017 21:25:02 +0200 Message-ID: <681b23ba-fbb7-1e01-e9ea-e87a236df8b4@aurox.ch> References: <87shjt65o7.fsf_-_@users.sourceforge.net> <20170525184635.GA34187@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1495827309 8750 195.159.176.226 (26 May 2017 19:35:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 May 2017 19:35:09 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: 27041@debbugs.gnu.org To: Alan Third , npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 26 21:35:05 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEL0q-0002Al-VV for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 May 2017 21:35:05 +0200 Original-Received: from localhost ([::1]:38136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEL0w-0005gF-Ha for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 May 2017 15:35:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEKsB-0003yC-Lv for bug-gnu-emacs@gnu.org; Fri, 26 May 2017 15:26:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEKs6-0006i9-Om for bug-gnu-emacs@gnu.org; Fri, 26 May 2017 15:26:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dEKs6-0006i3-Gc for bug-gnu-emacs@gnu.org; Fri, 26 May 2017 15:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dEKs6-0004WT-8Y for bug-gnu-emacs@gnu.org; Fri, 26 May 2017 15:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 May 2017 19:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27041 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27041-submit@debbugs.gnu.org id=B27041.149582671417329 (code B ref 27041); Fri, 26 May 2017 19:26:02 +0000 Original-Received: (at 27041) by debbugs.gnu.org; 26 May 2017 19:25:14 +0000 Original-Received: from localhost ([127.0.0.1]:39597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEKrK-0004VR-87 for submit@debbugs.gnu.org; Fri, 26 May 2017 15:25:14 -0400 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:55518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEKrI-0004VE-OR for 27041@debbugs.gnu.org; Fri, 26 May 2017 15:25:13 -0400 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 3660C22447 for <27041@debbugs.gnu.org>; Fri, 26 May 2017 19:20:37 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1495826435; x= 1496690436; bh=XH6xcTGbPeamfWETVApLGFrQ6dGyP8OU1+CQVJOS/JU=; b=T VNS9JJ3R3yGWviClAZBoby/r8EyCl6I0K7wn3g6+foP2nb950xKoYYg4YqiVfjLq ag9m59XRebt1687nEMY8hXF8KEsEHs2468DPoUr/zlPqjmqS40m5HMAfLBI/UMy0 u6A9jrPfvZx6Ei34kOt/EJ6OKXwKOJSoKJv2HU2NlU= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Original-Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ajNIRk84LYAk for <27041@debbugs.gnu.org>; Fri, 26 May 2017 19:20:35 +0000 (UTC) Original-Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 2246B22423; Fri, 26 May 2017 19:20:34 +0000 (UTC) In-Reply-To: <20170525184635.GA34187@breton.holly.idiocy.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132896 Archived-At: All good. Thanks for the help! On 25/05/2017 20:46, Alan Third wrote: > * 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 */