unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27059: Can't compile master branch on Mac OS X
@ 2017-05-24 16:22 David Caldwell
  2017-05-24 20:20 ` Philipp Stephani
  2017-05-25 21:12 ` OKAZAKI Tetsurou
  0 siblings, 2 replies; 16+ messages in thread
From: David Caldwell @ 2017-05-24 16:22 UTC (permalink / raw)
  To: 27059

On Mac OS X 10.9 (Mavericks) and Mac OS X 10.8 (Mountain Lion):

  CC       nsterm.o
nsterm.m:5496:33: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
  return NSRunAlertPanel(title, msgFormat, defaultButton,
alternateButton, nil)
                                ^~~~~~~~~
1 warning generated.
  CC       nsfns.o
  CC       nsmenu.o
nsmenu.m:1496:70: error: expected a type
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle
                                                                     ^
nsmenu.m:1520:10: warning: incompatible integer to pointer conversion
assigning to 'id' from 'int' [-Wint-conversion]
  aStyle =
NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
         ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nsmenu.m:1524:54: warning: incompatible pointer to integer conversion
sending 'id' to parameter of type 'NSUInteger' (aka 'unsigned long')
[-Wint-conversion]
  [super initWithContentRect: contentRect styleMask: aStyle
                                                     ^~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:289:69:
note: passing argument to parameter 'aStyle' here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                                    ^
nsmenu.m:1496:88: warning: conflicting parameter types in implementation
of 'initWithContentRect:styleMask:backing:defer:': 'NSUInteger' (aka
'unsigned long') vs 'id' [-Wmismatched-parameter-types]
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle

              ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:289:69:
note: previous definition is here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                         ~~~~~~~~~~ ^
3 warnings and 1 error generated.
make[1]: *** [nsmenu.o] Error 1
make: *** [src] Error 2
make failed



On Mac OS X 10.6 (Snow Leopard):
  CC       nsterm.o
In file included from nsterm.m:48:
nsterm.h:454: error: expected ')' before 'instancetype'
nsterm.h:455: error: expected ')' before 'instancetype'
nsterm.h:456: error: expected ')' before 'instancetype'
nsterm.h:460: error: expected ')' before 'instancetype'
nsterm.h:463: error: expected ')' before 'instancetype'
nsterm.h:523: error: expected ')' before 'instancetype'
nsterm.h:557: error: expected ')' before 'instancetype'
nsterm.h:592: error: expected ')' before 'instancetype'
nsterm.h:611: error: expected ')' before 'instancetype'
nsterm.h:659: error: expected ')' before 'instancetype'
nsterm.h:661: error: expected ')' before 'instancetype'
nsterm.h:663: error: expected ')' before 'instancetype'
nsterm.h:664: error: expected ')' before 'instancetype'
nsterm.h:703: error: expected ')' before 'instancetype'
nsterm.h:706: error: expected ')' before 'instancetype'
nsterm.h:710: error: expected ')' before 'instancetype'
nsterm.h:711: error: expected ')' before 'instancetype'
nsterm.h:712: error: expected ')' before 'instancetype'
nsterm.h:735: error: expected ')' before 'instancetype'
nsterm.m:6900: error: expected ')' before 'instancetype'
nsterm.m:7630: error: expected ')' before 'instancetype'
nsterm.m:7655: error: expected ')' before 'instancetype'
nsterm.m:7681: error: expected ')' before 'instancetype'
nsterm.m:7909: error: expected ')' before 'instancetype'
nsterm.m:8261: error: expected ')' before 'instancetype'
nsterm.m:8345: error: expected ')' before 'instancetype'
nsterm.m:8353: error: expected ')' before 'instancetype'
nsterm.m:8408: error: expected ')' before 'instancetype'
nsterm.m:8487: error: expected ')' before 'instancetype'
make[1]: *** [nsterm.o] Error 1
make: *** [src] Error 2
make failed


I think these may have been caused by the recent GNUStep changes.

-David





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

* bug#27059: Can't compile master branch on Mac OS X
  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 21:12 ` OKAZAKI Tetsurou
  1 sibling, 1 reply; 16+ messages in thread
From: Philipp Stephani @ 2017-05-24 20:20 UTC (permalink / raw)
  To: David Caldwell, 27059

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

David Caldwell <david@porkrind.org> schrieb am Mi., 24. Mai 2017 um
18:24 Uhr:

> On Mac OS X 10.9 (Mavericks) and Mac OS X 10.8 (Mountain Lion):
>
>   CC       nsterm.o
> nsterm.m:5496:33: warning: format string is not a string literal
> (potentially insecure) [-Wformat-security]
>   return NSRunAlertPanel(title, msgFormat, defaultButton,
> alternateButton, nil)
>                                 ^~~~~~~~~
> 1 warning generated.
>   CC       nsfns.o
>   CC       nsmenu.o
> nsmenu.m:1496:70: error: expected a type
> - (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
> (NSWindowStyleMask)aStyle
>                                                                      ^
> nsmenu.m:1520:10: warning: incompatible integer to pointer conversion
> assigning to 'id' from 'int' [-Wint-conversion]
>   aStyle =
>
> NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
>          ^
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> nsmenu.m:1524:54: warning: incompatible pointer to integer conversion
> sending 'id' to parameter of type 'NSUInteger' (aka 'unsigned long')
> [-Wint-conversion]
>   [super initWithContentRect: contentRect styleMask: aStyle
>                                                      ^~~~~~
> /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:289:69:
> note: passing argument to parameter 'aStyle' here
> - (id)initWithContentRect:(NSRect)contentRect
> styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
> defer:(BOOL)flag;
>                                                                     ^
> nsmenu.m:1496:88: warning: conflicting parameter types in implementation
> of 'initWithContentRect:styleMask:backing:defer:': 'NSUInteger' (aka
> 'unsigned long') vs 'id' [-Wmismatched-parameter-types]
> - (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
> (NSWindowStyleMask)aStyle
>
>               ^
> /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:289:69:
> note: previous definition is here
> - (id)initWithContentRect:(NSRect)contentRect
> styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
> defer:(BOOL)flag;
>                                                          ~~~~~~~~~~ ^
> 3 warnings and 1 error generated.
> make[1]: *** [nsmenu.o] Error 1
> make: *** [src] Error 2
> make failed
>
>
>
> On Mac OS X 10.6 (Snow Leopard):
>   CC       nsterm.o
> In file included from nsterm.m:48:
> nsterm.h:454: error: expected ')' before 'instancetype'
> nsterm.h:455: error: expected ')' before 'instancetype'
> nsterm.h:456: error: expected ')' before 'instancetype'
> nsterm.h:460: error: expected ')' before 'instancetype'
> nsterm.h:463: error: expected ')' before 'instancetype'
> nsterm.h:523: error: expected ')' before 'instancetype'
> nsterm.h:557: error: expected ')' before 'instancetype'
> nsterm.h:592: error: expected ')' before 'instancetype'
> nsterm.h:611: error: expected ')' before 'instancetype'
> nsterm.h:659: error: expected ')' before 'instancetype'
> nsterm.h:661: error: expected ')' before 'instancetype'
> nsterm.h:663: error: expected ')' before 'instancetype'
> nsterm.h:664: error: expected ')' before 'instancetype'
> nsterm.h:703: error: expected ')' before 'instancetype'
> nsterm.h:706: error: expected ')' before 'instancetype'
> nsterm.h:710: error: expected ')' before 'instancetype'
> nsterm.h:711: error: expected ')' before 'instancetype'
> nsterm.h:712: error: expected ')' before 'instancetype'
> nsterm.h:735: error: expected ')' before 'instancetype'
> nsterm.m:6900: error: expected ')' before 'instancetype'
> nsterm.m:7630: error: expected ')' before 'instancetype'
> nsterm.m:7655: error: expected ')' before 'instancetype'
> nsterm.m:7681: error: expected ')' before 'instancetype'
> nsterm.m:7909: error: expected ')' before 'instancetype'
> nsterm.m:8261: error: expected ')' before 'instancetype'
> nsterm.m:8345: error: expected ')' before 'instancetype'
> nsterm.m:8353: error: expected ')' before 'instancetype'
> nsterm.m:8408: error: expected ')' before 'instancetype'
> nsterm.m:8487: error: expected ')' before 'instancetype'
> make[1]: *** [nsterm.o] Error 1
> make: *** [src] Error 2
> make failed
>
>
> I think these may have been caused by the recent GNUStep changes.
>

Can you try applying the following patch:

diff --git a/src/nsterm.h b/src/nsterm.h
index 8f3d92b353..288b91269d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -65,7 +65,7 @@ typedef float EmacsCGFloat;
 /* 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)
+#if defined (NS_IMPL_GNUSTEP) \
     || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
 typedef id instancetype;
 typedef NSUInteger NSWindowStyleMask;

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

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-24 20:20 ` Philipp Stephani
@ 2017-05-25 16:25   ` David Caldwell
  2017-05-25 19:02     ` Alan Third
  0 siblings, 1 reply; 16+ messages in thread
From: David Caldwell @ 2017-05-25 16:25 UTC (permalink / raw)
  To: Philipp Stephani, 27059


[-- Attachment #1.1: Type: text/plain, Size: 1976 bytes --]

On 5/24/17 1:20 PM, Philipp Stephani wrote:
> 
> 
> David Caldwell <david@porkrind.org <mailto:david@porkrind.org>> schrieb
> am Mi., 24. Mai 2017 um 18:24 Uhr:
> 
>       CC       nsmenu.o
>     nsmenu.m:1496:70: error: expected a type
>     - (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
>     (NSWindowStyleMask)aStyle
> 
> Can you try applying the following patch:
> 
> diff --git a/src/nsterm.h b/src/nsterm.h
> index 8f3d92b353..288b91269d 100644
> --- a/src/nsterm.h
> +++ b/src/nsterm.h
> @@ -65,7 +65,7 @@ typedef float EmacsCGFloat;
>  /* 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)
> +#if defined (NS_IMPL_GNUSTEP) \
>      || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
>  typedef id instancetype;
>  typedef NSUInteger NSWindowStyleMask;
> 

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:

diff --git a/src/nsterm.h b/src/nsterm.h
index 8f3d92b353..04ec82814a 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -65,8 +65,8 @@ typedef float EmacsCGFloat;
 /* 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
+#if defined (NS_IMPL_GNUSTEP) \
+    || MAC_OS_X_VERSION_MAX_ALLOWED < 101000
 typedef id instancetype;
 typedef NSUInteger NSWindowStyleMask;
 #endif


-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-25 16:25   ` David Caldwell
@ 2017-05-25 19:02     ` Alan Third
  2017-05-26 17:23       ` David Caldwell
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Third @ 2017-05-25 19:02 UTC (permalink / raw)
  To: David Caldwell; +Cc: Philipp Stephani, 27059

[-- 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


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

* bug#27059: Can't compile master branch on Mac OS X
  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 21:12 ` OKAZAKI Tetsurou
  1 sibling, 0 replies; 16+ messages in thread
From: OKAZAKI Tetsurou @ 2017-05-25 21:12 UTC (permalink / raw)
  To: 27059

> 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:

NSWindowStyleMask introduced since 10.12.
SDK 10.10 requires typedef too to compile master branch.





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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-25 19:02     ` Alan Third
@ 2017-05-26 17:23       ` David Caldwell
  2017-05-26 18:47         ` Philipp Stephani
  2017-05-26 19:30         ` David Caldwell
  0 siblings, 2 replies; 16+ messages in thread
From: David Caldwell @ 2017-05-26 17:23 UTC (permalink / raw)
  To: Alan Third; +Cc: Philipp Stephani, 27059


[-- Attachment #1.1: Type: text/plain, Size: 2882 bytes --]

On 5/25/17 12:02 PM, Alan Third wrote:
> 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.

I tried the patch out, still has problems (this output is from Mac OS 10.9):

  CC       nsmenu.o
nsmenu.m:1496:70: error: expected a type
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle
                                                                     ^
nsmenu.m:1520:10: warning: incompatible integer to pointer conversion
assigning to 'id' from 'int' [-Wint-conversion]
  aStyle =
NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
         ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nsmenu.m:1524:54: warning: incompatible pointer to integer conversion
sending 'id' to parameter of type 'NSUInteger' (aka 'unsigned long')
[-Wint-conversion]
  [super initWithContentRect: contentRect styleMask: aStyle
                                                     ^~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:301:69:
note: passing argument to parameter 'aStyle' here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                                    ^
nsmenu.m:1496:88: warning: conflicting parameter types in implementation
of 'initWithContentRect:styleMask:backing:defer:': 'NSUInteger' (aka
'unsigned long') vs 'id' [-Wmismatched-parameter-types]
- (instancetype)initWithContentRect: (NSRect)contentRect styleMask:
(NSWindowStyleMask)aStyle

              ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:301:69:
note: previous definition is here
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
                                                         ~~~~~~~~~~ ^
3 warnings and 1 error generated.
make: *** [nsmenu.o] Error 1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-26 17:23       ` David Caldwell
@ 2017-05-26 18:47         ` Philipp Stephani
  2017-05-26 19:30         ` David Caldwell
  1 sibling, 0 replies; 16+ messages in thread
From: Philipp Stephani @ 2017-05-26 18:47 UTC (permalink / raw)
  To: David Caldwell, Alan Third; +Cc: 27059

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

David Caldwell <david@porkrind.org> schrieb am Fr., 26. Mai 2017 um
19:23 Uhr:

> On 5/25/17 12:02 PM, Alan Third wrote:
> > 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.
>
> I tried the patch out, still has problems (this output is from Mac OS
> 10.9):
>

Can you try the following patch on top:

diff --git a/src/nsterm.h b/src/nsterm.h
index f75e3759e4..77c7729c96 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1264,6 +1264,7 @@ extern char gnustep_base_version[];  /* version
tracking */

 /* macOS 10.12 deprecates a bunch of constants. */
 #if !defined (NS_IMPL_COCOA) || \
+  ! defined MAC_OS_X_VERSION_10_12 || \
   MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
 #define NSEventModifierFlagCommand         NSCommandKeyMask
 #define NSEventModifierFlagControl         NSControlKeyMask

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

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

* bug#27059: Can't compile master branch on Mac OS X
  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
  1 sibling, 1 reply; 16+ messages in thread
From: David Caldwell @ 2017-05-26 19:30 UTC (permalink / raw)
  To: Alan Third; +Cc: Philipp Stephani, 27059


[-- Attachment #1.1: Type: text/plain, Size: 1342 bytes --]

On 5/26/17 10:23 AM, David Caldwell wrote:
> On 5/25/17 12:02 PM, Alan Third wrote:
>> 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.
> 
> I tried the patch out, still has problems (this output is from Mac OS 10.9):

Crap. Ignore that last failure report, I accidentally tested a version
with the patch unapplied. When I actually test correctly, the patch
works. I tested on 10.6 and 10.8 (and I assume that the ones in between
also work :-)). Thanks!

-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-26 19:30         ` David Caldwell
@ 2017-05-26 23:58           ` Alan Third
  2017-05-29  6:55             ` David Caldwell
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Third @ 2017-05-26 23:58 UTC (permalink / raw)
  To: David Caldwell; +Cc: Philipp Stephani, 27059

On Fri, May 26, 2017 at 12:30:44PM -0700, David Caldwell wrote:
> On 5/26/17 10:23 AM, David Caldwell wrote:
> > On 5/25/17 12:02 PM, Alan Third wrote:
> >> 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.
> > 
> > I tried the patch out, still has problems (this output is from Mac OS 10.9):
> 
> Crap. Ignore that last failure report, I accidentally tested a version
> with the patch unapplied. When I actually test correctly, the patch
> works. I tested on 10.6 and 10.8 (and I assume that the ones in between
> also work :-)). Thanks!

Thanks. I’ve pushed the change to master.
-- 
Alan Third





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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-26 23:58           ` Alan Third
@ 2017-05-29  6:55             ` David Caldwell
  2017-05-29  8:24               ` Alan Third
  0 siblings, 1 reply; 16+ messages in thread
From: David Caldwell @ 2017-05-29  6:55 UTC (permalink / raw)
  To: Alan Third; +Cc: Philipp Stephani, 27059


[-- Attachment #1.1: Type: text/plain, Size: 543 bytes --]

On 5/26/17 4:58 PM, Alan Third wrote:
> Thanks. I’ve pushed the change to master.

Thanks. Emacs compiles on 10.7 and above, but I'm still getting an error
on 10.6. It's a different part of the code, maybe it should be a new bug?

  CC       nsfns.o
nsfns.m: In function 'compute_tip_xy':
nsfns.m:2756: error: incompatible type for argument 1 of
'CGRectContainsPoint'
nsfns.m:2756: error: incompatible type for argument 2 of
'CGRectContainsPoint'
make[1]: *** [nsfns.o] Error 1
make: *** [src] Error 2
make failed

-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-29  6:55             ` David Caldwell
@ 2017-05-29  8:24               ` Alan Third
  2017-05-29  8:56                 ` David Caldwell
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Third @ 2017-05-29  8:24 UTC (permalink / raw)
  To: David Caldwell; +Cc: 27059, Philipp Stephani

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

On 29 May 2017 7:56 a.m., "David Caldwell" <david@porkrind.org> wrote:

On 5/26/17 4:58 PM, Alan Third wrote:
> Thanks. I’ve pushed the change to master.

Thanks. Emacs compiles on 10.7 and above, but I'm still getting an error
on 10.6. It's a different part of the code, maybe it should be a new bug?

  CC       nsfns.o
nsfns.m: In function 'compute_tip_xy':
nsfns.m:2756: error: incompatible type for argument 1 of
'CGRectContainsPoint'
nsfns.m:2756: error: incompatible type for argument 2 of
'CGRectContainsPoint'
make[1]: *** [nsfns.o] Error 1
make: *** [src] Error 2
make failed


Hmm, this is a bit strange. Perhaps we need to cast the arguments to CGRect
and CGPoint explicitly, but I don't see why, and surely that would be a
warning rather than an error.

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

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-29  8:24               ` Alan Third
@ 2017-05-29  8:56                 ` David Caldwell
  2017-05-29 16:05                   ` Alan Third
  0 siblings, 1 reply; 16+ messages in thread
From: David Caldwell @ 2017-05-29  8:56 UTC (permalink / raw)
  To: Alan Third; +Cc: 27059, Philipp Stephani


[-- Attachment #1.1: Type: text/plain, Size: 1261 bytes --]

On 5/29/17 1:24 AM, Alan Third wrote:
> 
> 
> On 29 May 2017 7:56 a.m., "David Caldwell" <david@porkrind.org
> <mailto:david@porkrind.org>> wrote:
> 
>     On 5/26/17 4:58 PM, Alan Third wrote:
>     > Thanks. I’ve pushed the change to master.
> 
>     Thanks. Emacs compiles on 10.7 and above, but I'm still getting an error
>     on 10.6. It's a different part of the code, maybe it should be a new
>     bug?
> 
>       CC       nsfns.o
>     nsfns.m: In function 'compute_tip_xy':
>     nsfns.m:2756: error: incompatible type for argument 1 of
>     'CGRectContainsPoint'
>     nsfns.m:2756: error: incompatible type for argument 2 of
>     'CGRectContainsPoint'
>     make[1]: *** [nsfns.o] Error 1
>     make: *** [src] Error 2
>     make failed
> 
> 
> Hmm, this is a bit strange. Perhaps we need to cast the arguments to
> CGRect and CGPoint explicitly, but I don't see why, and surely that
> would be a warning rather than an error.

Yeah, it's defined in NSGeometry.h as:
    typedef CGRect NSRect;
...which should make them compatible. Maybe it's something in the old
version of gcc (4.2.1) that 10.6 X-Code uses by default.

Nevertheless, you are right--Putting the explicit cast in makes it compile.

-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-29  8:56                 ` David Caldwell
@ 2017-05-29 16:05                   ` Alan Third
  2017-05-30 18:36                     ` David Caldwell
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Third @ 2017-05-29 16:05 UTC (permalink / raw)
  To: David Caldwell; +Cc: 27059, Philipp Stephani

On Mon, May 29, 2017 at 01:56:05AM -0700, David Caldwell wrote:
> Nevertheless, you are right--Putting the explicit cast in makes it compile.

Pushed fix to master.

Thanks!
-- 
Alan Third





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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-29 16:05                   ` Alan Third
@ 2017-05-30 18:36                     ` David Caldwell
  2017-05-30 19:01                       ` Alan Third
  0 siblings, 1 reply; 16+ messages in thread
From: David Caldwell @ 2017-05-30 18:36 UTC (permalink / raw)
  To: Alan Third; +Cc: 27059, Philipp Stephani


[-- Attachment #1.1: Type: text/plain, Size: 1194 bytes --]

On 5/29/17 9:05 AM, Alan Third wrote:
> On Mon, May 29, 2017 at 01:56:05AM -0700, David Caldwell wrote:
>> Nevertheless, you are right--Putting the explicit cast in makes it compile.
> 
> Pushed fix to master.

Still not quite there :-/

This time the error happens on 10.6 compiling for 32 bit targets
(compiler is i686-apple-darwin10-gcc-4.2.1):

i686-apple-darwin10-gcc-4.2.1 -mmacosx-version-min=10.6  -std=gnu99 -c
-Demacs  -I. -I. -I../lib -I../lib         -I'/usr/include/libxml2'
      -MMD -MF deps/nsfns.d -MP       -g3 -O2   nsfns.m
nsfns.m: In function 'compute_tip_xy':
nsfns.m:2756: error: conversion to non-scalar type requested
nsfns.m:2756: error: conversion to non-scalar type requested
make[1]: *** [nsfns.o] Error 1
make: *** [src] Error 2

This was the best I could come up with for this compiler:

    NSRect r = [screen frame];
    if (CGRectContainsPoint (*(CGRect*)&r, *(CGPoint*)&pt))

(yuck). Interestingly, I tried searching for this and found this thread
from 15 years ago:
https://lists.apple.com/archives/cocoa-dev/2002/Jan/msg00763.html

Maybe it would be better to fall back to the GNUStep else clause in
these cases?

-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-30 18:36                     ` David Caldwell
@ 2017-05-30 19:01                       ` Alan Third
  2017-05-31 23:39                         ` David Caldwell
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Third @ 2017-05-30 19:01 UTC (permalink / raw)
  To: David Caldwell; +Cc: 27059, Philipp Stephani

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

On Tue, May 30, 2017 at 11:36:43AM -0700, David Caldwell wrote:
> nsfns.m: In function 'compute_tip_xy':
> nsfns.m:2756: error: conversion to non-scalar type requested
> nsfns.m:2756: error: conversion to non-scalar type requested
> make[1]: *** [nsfns.o] Error 1
> make: *** [src] Error 2
> 
> This was the best I could come up with for this compiler:
> 
>     NSRect r = [screen frame];
>     if (CGRectContainsPoint (*(CGRect*)&r, *(CGPoint*)&pt))
> 
> (yuck).

Indeed.

> Maybe it would be better to fall back to the GNUStep else clause in
> these cases?

That’s exactly what I was thinking as I read through this. There’s no
reason not to, afaict it is exactly equivalent.

I’ve attached a patch that reverts to the GNUstep code in all cases
and explains why.

-- 
Alan Third

[-- Attachment #2: 0001-Fix-build-errors-on-macOS-10.6.patch --]
[-- Type: text/plain, Size: 1315 bytes --]

From 1936a82c889ee6c11c7b19f126afd06e6c950565 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 30 May 2017 19:48:17 +0100
Subject: [PATCH] Fix build errors on macOS 10.6

* src/nsfns.m (compute_tip_xy): Don't use CGRectContainsPoint.
---
 src/nsfns.m | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index 7bac2836fe..0c865070fb 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2752,16 +2752,19 @@ and GNUstep implementations ("distributor-specific release
 
   /* Find the screen that pt is on. */
   for (screen in [NSScreen screens])
-#ifdef NS_IMPL_COCOA
-    if (CGRectContainsPoint ((CGRect)[screen frame], (CGPoint)pt))
-#else
     if (pt.x >= screen.frame.origin.x
         && pt.x < screen.frame.origin.x + screen.frame.size.width
         && pt.y >= screen.frame.origin.y
         && pt.y < screen.frame.origin.y + screen.frame.size.height)
-#endif
       break;
 
+  /* We could use this instead of the if above:
+
+         if (CGRectContainsPoint ([screen frame], pt))
+
+     which would be neater, but it causes problems building on old
+     versions of macOS and in GNUstep. */
+
   /* Ensure in bounds.  (Note, screen origin = lower left.) */
   if (INTEGERP (left) || INTEGERP (right))
     *root_x = pt.x;
-- 
2.12.0


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

* bug#27059: Can't compile master branch on Mac OS X
  2017-05-30 19:01                       ` Alan Third
@ 2017-05-31 23:39                         ` David Caldwell
  0 siblings, 0 replies; 16+ messages in thread
From: David Caldwell @ 2017-05-31 23:39 UTC (permalink / raw)
  To: Alan Third; +Cc: 27059, Philipp Stephani


[-- Attachment #1.1: Type: text/plain, Size: 1053 bytes --]

On 5/30/17 12:01 PM, Alan Third wrote:
> On Tue, May 30, 2017 at 11:36:43AM -0700, David Caldwell wrote:
>> nsfns.m: In function 'compute_tip_xy':
>> nsfns.m:2756: error: conversion to non-scalar type requested
>> nsfns.m:2756: error: conversion to non-scalar type requested
>> make[1]: *** [nsfns.o] Error 1
>> make: *** [src] Error 2
>>
>> This was the best I could come up with for this compiler:
>>
>>     NSRect r = [screen frame];
>>     if (CGRectContainsPoint (*(CGRect*)&r, *(CGPoint*)&pt))
>>
>> (yuck).
> 
> Indeed.
> 
>> Maybe it would be better to fall back to the GNUStep else clause in
>> these cases?
> 
> That’s exactly what I was thinking as I read through this. There’s no
> reason not to, afaict it is exactly equivalent.
> 
> I’ve attached a patch that reverts to the GNUstep code in all cases
> and explains why.

I like it. That patch works on this old compiler--with it i686 gcc now
gets to the elisp compilation phase (I didn't have the patience to sit
through that part ;-)).

-David




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

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

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).