diff options
| author | Po Lu | 2022-01-06 14:10:52 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-06 14:10:52 +0800 |
| commit | 3b1164de0ed126686977e8688f2e09268cb74e4d (patch) | |
| tree | 5819ef24d85cac330b2f741c3b29296b6b2083e6 /src | |
| parent | e882dd48e3c3d6aa443383016c36f53683cd3048 (diff) | |
| download | emacs-3b1164de0ed126686977e8688f2e09268cb74e4d.tar.gz emacs-3b1164de0ed126686977e8688f2e09268cb74e4d.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/emacs.c | 7 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 20 |
4 files changed, 22 insertions, 9 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 83210b1317a..04fabd5f424 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -379,7 +379,7 @@ pdmp := | |||
| 379 | endif | 379 | endif |
| 380 | 380 | ||
| 381 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. | 381 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. |
| 382 | NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd | 382 | NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd -Wnested-externs |
| 383 | # Ditto, but for C++. | 383 | # Ditto, but for C++. |
| 384 | NON_CXX_CFLAGS = -Wmissing-prototypes -Wnested-externs -Wold-style-definition \ | 384 | NON_CXX_CFLAGS = -Wmissing-prototypes -Wnested-externs -Wold-style-definition \ |
| 385 | -Wstrict-prototypes -Wno-override-init | 385 | -Wstrict-prototypes -Wno-override-init |
diff --git a/src/emacs.c b/src/emacs.c index 3b708db7796..f6e2c01ee74 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -875,9 +875,14 @@ load_pdump (int argc, char **argv) | |||
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | /* Where's our executable? */ | 877 | /* Where's our executable? */ |
| 878 | ptrdiff_t bufsize, exec_bufsize; | 878 | ptrdiff_t bufsize; |
| 879 | #ifndef NS_SELF_CONTAINED | ||
| 880 | ptrdiff_t exec_bufsize; | ||
| 881 | #endif | ||
| 879 | emacs_executable = load_pdump_find_executable (argv[0], &bufsize); | 882 | emacs_executable = load_pdump_find_executable (argv[0], &bufsize); |
| 883 | #ifndef NS_SELF_CONTAINED | ||
| 880 | exec_bufsize = bufsize; | 884 | exec_bufsize = bufsize; |
| 885 | #endif | ||
| 881 | 886 | ||
| 882 | /* If we couldn't find our executable, go straight to looking for | 887 | /* If we couldn't find our executable, go straight to looking for |
| 883 | the dump in the hardcoded location. */ | 888 | the dump in the hardcoded location. */ |
diff --git a/src/image.c b/src/image.c index 439348759fd..e7d347b7820 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -82,7 +82,9 @@ typedef struct x_bitmap_record Bitmap_Record; | |||
| 82 | 82 | ||
| 83 | #if defined(USE_CAIRO) || defined(HAVE_NS) | 83 | #if defined(USE_CAIRO) || defined(HAVE_NS) |
| 84 | #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) | 84 | #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) |
| 85 | #ifndef HAVE_NS | ||
| 85 | #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) | 86 | #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) |
| 87 | #endif | ||
| 86 | #define RED_FROM_ULONG(color) (((color) >> 16) & 0xff) | 88 | #define RED_FROM_ULONG(color) (((color) >> 16) & 0xff) |
| 87 | #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff) | 89 | #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff) |
| 88 | #define BLUE_FROM_ULONG(color) ((color) & 0xff) | 90 | #define BLUE_FROM_ULONG(color) ((color) & 0xff) |
diff --git a/src/nsterm.m b/src/nsterm.m index 382aa57a125..428d1a2fe22 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1617,10 +1617,17 @@ ns_destroy_window (struct frame *f) | |||
| 1617 | 1617 | ||
| 1618 | /* If this frame has a parent window, detach it as not doing so can | 1618 | /* If this frame has a parent window, detach it as not doing so can |
| 1619 | cause a crash in GNUStep. */ | 1619 | cause a crash in GNUStep. */ |
| 1620 | if (FRAME_PARENT_FRAME (f) != NULL) | 1620 | if (FRAME_PARENT_FRAME (f)) |
| 1621 | { | 1621 | { |
| 1622 | NSWindow *child = [FRAME_NS_VIEW (f) window]; | 1622 | NSWindow *child = [FRAME_NS_VIEW (f) window]; |
| 1623 | NSWindow *parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; | 1623 | NSWindow *parent; |
| 1624 | |||
| 1625 | /* Pacify a incorrect GCC warning about FRAME_PARENT_FRAME (f) | ||
| 1626 | being NULL. */ | ||
| 1627 | if (FRAME_PARENT_FRAME (f)) | ||
| 1628 | parent = [FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)) window]; | ||
| 1629 | else | ||
| 1630 | emacs_abort (); | ||
| 1624 | 1631 | ||
| 1625 | [parent removeChildWindow: child]; | 1632 | [parent removeChildWindow: child]; |
| 1626 | } | 1633 | } |
| @@ -2086,8 +2093,8 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col) | |||
| 2086 | return 1; | 2093 | return 1; |
| 2087 | } | 2094 | } |
| 2088 | 2095 | ||
| 2089 | void | 2096 | static void |
| 2090 | ns_query_color(void *col, Emacs_Color *color_def) | 2097 | ns_query_color (void *col, Emacs_Color *color_def) |
| 2091 | /* -------------------------------------------------------------------------- | 2098 | /* -------------------------------------------------------------------------- |
| 2092 | Get ARGB values out of NSColor col and put them into color_def | 2099 | Get ARGB values out of NSColor col and put them into color_def |
| 2093 | and set color_def pixel to the ARGB color. | 2100 | and set color_def pixel to the ARGB color. |
| @@ -4481,7 +4488,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4481 | 4488 | ||
| 4482 | #ifdef HAVE_PTHREAD | 4489 | #ifdef HAVE_PTHREAD |
| 4483 | void | 4490 | void |
| 4484 | ns_run_loop_break () | 4491 | ns_run_loop_break (void) |
| 4485 | /* Break out of the NS run loop in ns_select or ns_read_socket. */ | 4492 | /* Break out of the NS run loop in ns_select or ns_read_socket. */ |
| 4486 | { | 4493 | { |
| 4487 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break"); | 4494 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_run_loop_break"); |
| @@ -7565,7 +7572,7 @@ not_in_argv (NSString *arg) | |||
| 7565 | EmacsWindow *w, *fw; | 7572 | EmacsWindow *w, *fw; |
| 7566 | BOOL onFirstScreen; | 7573 | BOOL onFirstScreen; |
| 7567 | struct frame *f; | 7574 | struct frame *f; |
| 7568 | NSRect r, wr; | 7575 | NSRect r; |
| 7569 | NSColor *col; | 7576 | NSColor *col; |
| 7570 | 7577 | ||
| 7571 | NSTRACE ("[EmacsView toggleFullScreen:]"); | 7578 | NSTRACE ("[EmacsView toggleFullScreen:]"); |
| @@ -7584,7 +7591,6 @@ not_in_argv (NSString *arg) | |||
| 7584 | w = (EmacsWindow *)[self window]; | 7591 | w = (EmacsWindow *)[self window]; |
| 7585 | onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]]; | 7592 | onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]]; |
| 7586 | f = emacsframe; | 7593 | f = emacsframe; |
| 7587 | wr = [w frame]; | ||
| 7588 | col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND | 7594 | col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND |
| 7589 | (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; | 7595 | (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; |
| 7590 | 7596 | ||