From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#27810: NS runtime feature detection Date: Tue, 1 Aug 2017 17:38:03 +0200 Message-ID: References: <1ce59431-ff6b-dc89-31a6-8fc5bd4e3926@aurox.ch> <20170718221629.GA55506@breton.holly.idiocy.org> <20170722112230.GA58424@breton.holly.idiocy.org> <20170723121701.GA3730@breton.holly.idiocy.org> <508a4930-feab-588b-0ab9-f55a10ea85ec@aurox.ch> <20170724204404.GA20189@breton.holly.idiocy.org> <20170726215746.GA59679@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114fbd16ed92ce0555b2eea1" X-Trace: blaine.gmane.org 1501601956 19792 195.159.176.226 (1 Aug 2017 15:39:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 Aug 2017 15:39:16 +0000 (UTC) Cc: Alan Third , 27810@debbugs.gnu.org To: "Charles A. Roelli" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 01 17:39:11 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 1dcZGH-0004kR-4p for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Aug 2017 17:39:09 +0200 Original-Received: from localhost ([::1]:43283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZGN-0003ou-3n for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Aug 2017 11:39:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZGD-0003nn-LC for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 11:39:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZGA-00032U-FA for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 11:39:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34430) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZGA-00032K-7t for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 11:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dcZGA-000264-2G for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2017 11:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Aug 2017 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27810 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27810-submit@debbugs.gnu.org id=B27810.15016018928002 (code B ref 27810); Tue, 01 Aug 2017 15:39:02 +0000 Original-Received: (at 27810) by debbugs.gnu.org; 1 Aug 2017 15:38:12 +0000 Original-Received: from localhost ([127.0.0.1]:37107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcZFM-00024z-A7 for submit@debbugs.gnu.org; Tue, 01 Aug 2017 11:38:12 -0400 Original-Received: from mail-ua0-f173.google.com ([209.85.217.173]:36652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcZFK-00024n-AX for 27810@debbugs.gnu.org; Tue, 01 Aug 2017 11:38:10 -0400 Original-Received: by mail-ua0-f173.google.com with SMTP id k43so8700206uaf.3 for <27810@debbugs.gnu.org>; Tue, 01 Aug 2017 08:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=B0Kgfcl0EOMkTDoqIO7/vWOtUwCp+j2FbyTfukQ2ZpM=; b=jVxWzbyZqZqaqxuSjwAj9LrkV6YHaA7/oqbIdzNKDLFZjZQ04NsFsFPWfxEk0vPBzY HFf2Wk4Cr1+OZos2H7sHwsD3tOsCaIRc4C2P6ZSnkAiTHPNhFuSI2Bo7aoY3OlQp6sCY A2FzpuDiduzyBalDOklTZJTBDQTLcKC8o5l7s8KAi+3vxEIhV4JmDoLUQuqxd9cnWbcw A0RjsqtQ1NoKNYZHNoFZEtglYypzwLTFOOXHmZwgOS/pXO3YhKd17bfgGtbjWsrRhb/C A08Y5rhmqTRzpatPmckR9R10HP8SjNEmvThIQDguJaQ5TrqFLc+VUzDbn6LC5fZH8opE 12pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=B0Kgfcl0EOMkTDoqIO7/vWOtUwCp+j2FbyTfukQ2ZpM=; b=Gw/FEGgs2IUe8PZIvtrBEWadXR6Vs2TdrnqkmIyGO0uEVypPswLQNnE9kbVyWUyrXg i6mKLMtI0Mu0xRgtB1nwfgQcEazaP5QL6RR2kHwkwjIp4qlHDYalE1gUujefYqPZK86n FartFYWyL3kB0VK8GX1UdRsKy0JF0TyK0C5YvZIgxPcjhqtEvd1DeGrjCUE511bfCBqq bf26LD8n2Xb+qpYCLJ2ODJXed5Gho7ezmFHC+8VY/+c1hN5/iqYSgV8KdY+IjKDYo0Qs 4Vr4TfDZiShca8W10PF5tnr2n2cMf/CclAdqt5RXhkx6pVMrYV+JZ4O2YgVE94ZQoTlS uQZQ== X-Gm-Message-State: AIVw111dtdOF0e7Andj3fPI1lbDq0ksOYYgCBOROwAmDeUdNhKsIQdHx 66yIjKR6gew/xpzLwQBdHWW4Lxj5Ex7z X-Received: by 10.176.68.71 with SMTP id m65mr15332422uam.121.1501601884638; Tue, 01 Aug 2017 08:38:04 -0700 (PDT) Original-Received: by 10.31.210.2 with HTTP; Tue, 1 Aug 2017 08:38:03 -0700 (PDT) In-Reply-To: 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:135218 Archived-At: --001a114fbd16ed92ce0555b2eea1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's always a good idea to enable warnings when undefined preprocessor symbols are used. In gcc this is -Wundef and I gess it's the same in clang. -- Anders On Mon, Jul 31, 2017 at 9:05 PM, Charles A. Roelli wrote= : > Shouldn't MIN_ALLOWED be MIN_REQUIRED? As in here: > > +#if defined (NS_IMPL_COCOA) \ > + && MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_X_VERSION_10_7 > +#if MAC_OS_X_VERSION_MIN_ALLOWED < MAC_OS_X_VERSION_10_7 > > There are a few more places that have a MIN_ALLOWED thing. This > always trips me up, so I'm not sure. > > And also, it's apparently feasible to do a runtime check for a > specific macOS, according to this: > > https://developer.apple.com/library/content/documentation/De > veloperTools/Conceptual/cross_development/Using/using.html#/ > /apple_ref/doc/uid/20002000-SW7 > > which mentions APPKIT_EXTERN double NSAppKitVersionNumber. I'm not > sure if they still define this on Sierra, though. But if they do, > then we can use this to fix the nsmenu.m problem. > > > > On 26/07/2017 23:57, Alan Third wrote: > >> On Mon, Jul 24, 2017 at 09:44:04PM +0100, Alan Third wrote: >> >>> I'm confused why the macro call you wrote doesn't prevent this. But >>>> when I change it to #if MAC_OS_X_VERSION_MIN_ALLOWED <=3D >>>> MAC_OS_X_VERSION_10_6, then it compiles. This min/max stuff always >>>> confuses me... >>>> >>> I=E2=80=99m unclear where we should be using MIN_REQUIRED vs MAX_ALLOWE= D, but >>> I think we=E2=80=99re OK with MAX everywhere for what we=E2=80=99re doi= ng. I=E2=80=99ve just >>> used MAX in both my new macros. >>> >> I think I finally worked it out by reading macfont.m. I=E2=80=99ve attac= hed >> YET ANOTHER version of this which doesn't use any custom macros. >> >> To compile for multiple versions you do something like: >> >> ./configure --with-ns CFLAGS=3D"-DMAC_OS_X_VERSION_MIN_REQUIRED=3D1070 >> -DMAC_OS_X_VERSION_MAX_ALLOWED=3D101200 -g -O3" >> >> By default max and min are set to the version you=E2=80=99re running on, >> afaict. Please be aware that 10.6 isn=E2=80=99t fully compatible with th= is at >> the moment, as there is at least one place (nsmenu.m:535) where >> there=E2=80=99s a bug fix for it that I can=E2=80=99t see an immediate w= ay of making >> dynamic. >> >> Additionally the native fullscreen stuff is based on a simple check >> against MAX. I expect I=E2=80=99ll be able to fix that with a bit of wor= k, >> though. >> >> I=E2=80=99d be interested to see if this builds on systems lower than 10= .10 >> with the above configure command. There are probably bits and pieces >> I=E2=80=99ve not quite got right. >> >> > --001a114fbd16ed92ce0555b2eea1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It's always a good idea to enable warnings when undefi= ned preprocessor symbols are used. In gcc this is=C2=A0-Wundef and I gess i= t's the same in clang.

=C2=A0 =C2=A0 -- Anders
=

On Mon, Jul= 31, 2017 at 9:05 PM, Charles A. Roelli <charles@aurox.ch> wr= ote:
Shouldn't MIN_ALLOWED be MIN_REQ= UIRED?=C2=A0 As in here:

+#if defined (NS_IMPL_COCOA) \
+=C2=A0 && MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_X_VERSION_10= _7
+#if MAC_OS_X_VERSION_MIN_ALLOWED < MAC_OS_X_VERSION_10_7

There are a few more places that have a MIN_ALLOWED thing.=C2=A0 This
always trips me up, so I'm not sure.

And also, it's apparently feasible to do a runtime check for a
specific macOS, according to this:

https://developer.apple.= com/library/content/documentation/DeveloperTools/Conceptual/cross= _development/Using/using.html#//apple_ref/doc/uid/20002000-S= W7

which mentions APPKIT_EXTERN double NSAppKitVersionNumber.=C2=A0 I'm no= t
sure if they still define this on Sierra, though.=C2=A0 But if they do,
then we can use this to fix the nsmenu.m problem.



On 26/07/2017 23:57, Alan Third wrote:
On Mon, Jul 24, 2017 at 09:44:04PM +0100, Alan Third wrote:
I'm confused why the macro call you wrote doesn't prevent this. But=
when I change it to #if MAC_OS_X_VERSION_MIN_ALLOWED <=3D
MAC_OS_X_VERSION_10_6, then it compiles.=C2=A0 This min/max stuff always confuses me...
I=E2=80=99m unclear where we should be using MIN_REQUIRED vs MAX_ALLOWED, b= ut
I think we=E2=80=99re OK with MAX everywhere for what we=E2=80=99re doing. = I=E2=80=99ve just
used MAX in both my new macros.
I think I finally worked it out by reading macfont.m. I=E2=80=99ve attached=
YET ANOTHER version of this which doesn't use any custom macros.

To compile for multiple versions you do something like:

./configure --with-ns CFLAGS=3D"-DMAC_OS_X_VERSION_MIN_REQUIRED= =3D1070 -DMAC_OS_X_VERSION_MAX_ALLOWED=3D101200 -g -O3"

By default max and min are set to the version you=E2=80=99re running on, afaict. Please be aware that 10.6 isn=E2=80=99t fully compatible with this = at
the moment, as there is at least one place (nsmenu.m:535) where
there=E2=80=99s a bug fix for it that I can=E2=80=99t see an immediate way = of making
dynamic.

Additionally the native fullscreen stuff is based on a simple check
against MAX. I expect I=E2=80=99ll be able to fix that with a bit of work,<= br> though.

I=E2=80=99d be interested to see if this builds on systems lower than 10.10=
with the above configure command. There are probably bits and pieces
I=E2=80=99ve not quite got right.



--001a114fbd16ed92ce0555b2eea1--