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.
This commit is contained in:
Po Lu 2022-01-06 14:10:52 +08:00
parent e882dd48e3
commit 3b1164de0e
4 changed files with 22 additions and 9 deletions

View file

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

View file

@ -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. */

View file

@ -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)

View file

@ -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))];