emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3b1164de0e 2/2: Fix GNUstep compilation warnings


From: Po Lu
Subject: master 3b1164de0e 2/2: Fix GNUstep compilation warnings
Date: Thu, 6 Jan 2022 01:13:08 -0500 (EST)

branch: master
commit 3b1164de0ed126686977e8688f2e09268cb74e4d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix GNUstep compilation warnings
    
    * src/Makefile.in (NON_OBJC_CFLAGS): Add `-Wnested-externs'.
    * src/emacs.c (load_pdump): Only define exec_bufsize if
    !NS_SELF_CONTAINED.
    * src/image.c (ARGB_TO_ULONG): Don't define if HAVE_NS.
    * src/nsterm.m (ns_destroy_window): Pacify incorrect GCC
    warning.
    (ns_query_color): Make static.
    (ns_run_loop_break): Fix old-style definition.
    ([EmacsView toggleFullScreen:]): Remove unused variable.
---
 src/Makefile.in |  2 +-
 src/emacs.c     |  7 ++++++-
 src/image.c     |  2 ++
 src/nsterm.m    | 20 +++++++++++++-------
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index 83210b1317..04fabd5f42 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -379,7 +379,7 @@ pdmp :=
 endif
 
 # Flags that might be in WARN_CFLAGS but are not valid for Objective C.
-NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd
+NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd 
-Wnested-externs
 # Ditto, but for C++.
 NON_CXX_CFLAGS = -Wmissing-prototypes -Wnested-externs -Wold-style-definition \
   -Wstrict-prototypes -Wno-override-init
diff --git a/src/emacs.c b/src/emacs.c
index 3b708db779..f6e2c01ee7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -875,9 +875,14 @@ load_pdump (int argc, char **argv)
     }
 
   /* Where's our executable?  */
-  ptrdiff_t bufsize, exec_bufsize;
+  ptrdiff_t bufsize;
+#ifndef NS_SELF_CONTAINED
+  ptrdiff_t exec_bufsize;
+#endif
   emacs_executable = load_pdump_find_executable (argv[0], &bufsize);
+#ifndef NS_SELF_CONTAINED
   exec_bufsize = bufsize;
+#endif
 
   /* If we couldn't find our executable, go straight to looking for
      the dump in the hardcoded location.  */
diff --git a/src/image.c b/src/image.c
index 439348759f..e7d347b782 100644
--- a/src/image.c
+++ b/src/image.c
@@ -82,7 +82,9 @@ typedef struct x_bitmap_record Bitmap_Record;
 
 #if defined(USE_CAIRO) || defined(HAVE_NS)
 #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
+#ifndef HAVE_NS
 #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | 
(b))
+#endif
 #define RED_FROM_ULONG(color)  (((color) >> 16) & 0xff)
 #define GREEN_FROM_ULONG(color)        (((color) >> 8) & 0xff)
 #define BLUE_FROM_ULONG(color) ((color) & 0xff)
diff --git a/src/nsterm.m b/src/nsterm.m
index 382aa57a12..428d1a2fe2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1617,10 +1617,17 @@ ns_destroy_window (struct frame *f)
 
   /* If this frame has a parent window, detach it as not doing so can
      cause a crash in GNUStep.  */
-  if (FRAME_PARENT_FRAME (f) != NULL)
+  if (FRAME_PARENT_FRAME (f))
     {
       NSWindow *child = [FRAME_NS_VIEW (f) window];
-      NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window];
+      NSWindow *parent;
+
+      /* Pacify a incorrect GCC warning about FRAME_PARENT_FRAME (f)
+        being NULL. */
+      if (FRAME_PARENT_FRAME (f))
+       parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window];
+      else
+       emacs_abort ();
 
       [parent removeChildWindow: child];
     }
@@ -2086,8 +2093,8 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
   return 1;
 }
 
-void
-ns_query_color(void *col, Emacs_Color *color_def)
+static void
+ns_query_color (void *col, Emacs_Color *color_def)
 /* --------------------------------------------------------------------------
          Get ARGB values out of NSColor col and put them into color_def
          and set color_def pixel to the ARGB color.
@@ -4481,7 +4488,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
 
 #ifdef HAVE_PTHREAD
 void
-ns_run_loop_break ()
+ns_run_loop_break (void)
 /* Break out of the NS run loop in ns_select or ns_read_socket.  */
 {
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break");
@@ -7565,7 +7572,7 @@ not_in_argv (NSString *arg)
   EmacsWindow *w, *fw;
   BOOL onFirstScreen;
   struct frame *f;
-  NSRect r, wr;
+  NSRect r;
   NSColor *col;
 
   NSTRACE ("[EmacsView toggleFullScreen:]");
@@ -7584,7 +7591,6 @@ not_in_argv (NSString *arg)
   w = (EmacsWindow *)[self window];
   onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
   f = emacsframe;
-  wr = [w frame];
   col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
                                 (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]