]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify gcc -Wmissing-variable-declarations
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 May 2024 17:08:48 +0000 (10:08 -0700)
committerEshel Yaron <me@eshelyaron.com>
Sun, 12 May 2024 15:49:28 +0000 (17:49 +0200)
This is a new warning diagnostic in GCC 14.
* lib-src/etags.c (mercury_heuristics_ratio):
* src/pgtkselect.c, src/xselect.c (selection_request_stack):
* src/xselect.c (outstanding_transfers):
* src/xterm.c (pending_selection_requests)
(x_dnd_waiting_for_motif_finish_display):
Now static.
* lib-src/make-docfile.c (close_emacs_globals):
Arrange for lispsym to be declared with extern first,
when compiling lread.c.
* src/alloc.c (gdb_make_enums_visible) [__GNUC__]:
* src/emacs.c (RCS_Id):
* src/keyboard.c (stop_character):
* src/print.c (print_output_debug_flag):
Now declared with extern first.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN) [MAIN_PROGRAM]:
Arrange for ID to be declared extern first.
* src/lisp.h (garbage_collection_inhibited):
* src/xterm.h (x_frame_parm_handlers):
Declare here, so that its interface is properly checked.  Other decls
removed.

(cherry picked from commit 99a5c75f3b0916affdc8ea4a25d4bc87e67bca88)

12 files changed:
lib-src/etags.c
lib-src/make-docfile.c
src/alloc.c
src/emacs.c
src/keyboard.c
src/lisp.h
src/pgtkselect.c
src/print.c
src/xdisp.c
src/xselect.c
src/xterm.c
src/xterm.h

index 84dfa527e986121e899aefc990944d53e2819e02..03bc55de03d0c8131523d4d2d63b4ce2253d0705 100644 (file)
@@ -705,7 +705,7 @@ and optionally Prolog-like definitions (first rule for a predicate or \
 function).\n\
 To enable this behavior, run etags using --declarations.";
 static bool with_mercury_definitions = false;
-float mercury_heuristics_ratio = MERCURY_HEURISTICS_RATIO;
+static float mercury_heuristics_ratio = MERCURY_HEURISTICS_RATIO;
 
 static const char *Objc_suffixes [] =
   { "lm",                      /* Objective lex file  */
index ac4f320f9a53acf18605d7b998ca64d5096ed84d..ee589e033971debd8ff055eacb64c58b6575dd84 100644 (file)
@@ -660,11 +660,11 @@ close_emacs_globals (ptrdiff_t num_symbols)
   printf (("};\n"
           "extern struct emacs_globals globals;\n"
           "\n"
-          "#ifndef DEFINE_SYMBOLS\n"
-          "extern\n"
-          "#endif\n"
-          "struct Lisp_Symbol lispsym[%td];\n"),
-         num_symbols);
+          "extern struct Lisp_Symbol lispsym[%td];\n"
+          "#ifdef DEFINE_SYMBOLS\n"
+          "struct Lisp_Symbol lispsym[%td];\n"
+          "#endif\n"),
+         num_symbols, num_symbols);
 }
 
 static void
index 4226cb1d1a01cc63665c217ca7a5bd9f2b952e22..28e32554472cb34a4de18e4717eaea3ce2352de6 100644 (file)
@@ -8338,7 +8338,7 @@ enum defined_HAVE_PGTK { defined_HAVE_PGTK = false };
    then xbacktrace could fail.  Similarly for the other enums and
    their values.  Some non-GCC compilers don't like these constructs.  */
 #ifdef __GNUC__
-union
+extern union enums_for_gdb
 {
   enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS;
   enum char_table_specials char_table_specials;
@@ -8353,5 +8353,6 @@ union
   enum pvec_type pvec_type;
   enum defined_HAVE_X_WINDOWS defined_HAVE_X_WINDOWS;
   enum defined_HAVE_PGTK defined_HAVE_PGTK;
-} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
+} const gdb_make_enums_visible;
+union enums_for_gdb const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
 #endif /* __GNUC__ */
index 22da39a4d1c5dc0c6cc1363dd601d921f46950d7..58c751eaa6adbbe0add00089de146dc2dbe5fa76 100644 (file)
@@ -166,6 +166,7 @@ static const char emacs_copyright[] = COPYRIGHT;
 static const char emacs_bugreport[] = PACKAGE_BUGREPORT;
 
 /* Put version info into the executable in the form that 'ident' uses.  */
+extern char const RCS_Id[];
 char const EXTERNALLY_VISIBLE RCS_Id[]
   = "$Id" ": GNU Emacs " PACKAGE_VERSION
     " (" EMACS_CONFIGURATION " " EMACS_CONFIG_FEATURES ") $";
index bd1bb3bb4befbfeffdcdd59f7c5625944d035aba..2995b3f906c3a0896e2a9fc0b5d1384a52968600 100644 (file)
@@ -3650,6 +3650,7 @@ readable_events (int flags)
 }
 
 /* Set this for debugging, to have a way to get out */
+extern int stop_character;
 int stop_character EXTERNALLY_VISIBLE;
 
 static KBOARD *
index 010d63e4dd9261a5d0844f6621d394c274392a06..41f8af35e8aa207b1ff539bda39946746eb78c12 100644 (file)
@@ -55,7 +55,8 @@ INLINE_HEADER_BEGIN
 
 #define DECLARE_GDB_SYM(type, id) type const id EXTERNALLY_VISIBLE
 #ifdef MAIN_PROGRAM
-# define DEFINE_GDB_SYMBOL_BEGIN(type, id) DECLARE_GDB_SYM (type, id)
+# define DEFINE_GDB_SYMBOL_BEGIN(type, id) \
+   extern DECLARE_GDB_SYM (type, id); DECLARE_GDB_SYM (type, id)
 # define DEFINE_GDB_SYMBOL_END(id) = id;
 #else
 # define DEFINE_GDB_SYMBOL_BEGIN(type, id) extern DECLARE_GDB_SYM (type, id)
@@ -4435,6 +4436,7 @@ extern void parse_str_as_multibyte (const unsigned char *, ptrdiff_t,
                                    ptrdiff_t *, ptrdiff_t *);
 
 /* Defined in alloc.c.  */
+extern intptr_t garbage_collection_inhibited;
 extern void *my_heap_start (void);
 extern void check_pure_size (void);
 unsigned char *resize_string_data (Lisp_Object, ptrdiff_t, int, int);
index b0ab15c60695974a165f5359bfdcd8a9bb979d7e..271411b87caf7155393a730cf19882efcf32eca9 100644 (file)
@@ -353,7 +353,7 @@ struct pgtk_selection_request
 /* Stack of selections currently being processed.
    NULL if all requests have been fully processed.  */
 
-struct pgtk_selection_request *selection_request_stack;
+static struct pgtk_selection_request *selection_request_stack;
 
 static void
 pgtk_push_current_selection_request (struct selection_input_event *se,
index 612d63b7e94a5e3a12f24829b0af0034b5736425..7aacd2b2e906c79882e5a6a347ce707b8fc5a1e5 100644 (file)
@@ -90,6 +90,7 @@ static ptrdiff_t print_number_index;
 static void print_interval (INTERVAL interval, void *pprintcharfun);
 
 /* GDB resets this to zero on W32 to disable OutputDebugString calls.  */
+extern bool print_output_debug_flag;
 bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
 
 \f
index 977412ed20a53c4e2f2a6b0e27b7306026f7113a..72be3ff14295b857bac02df9bbe9ba437f90ea47 100644 (file)
@@ -13195,8 +13195,6 @@ truncate_message_1 (void *a1, Lisp_Object a2)
   return false;
 }
 
-extern intptr_t garbage_collection_inhibited;
-
 /* Set the current message to STRING.  */
 
 static void
index fd0f06eeed9962cc4ec322cfd72f7a98e2e53a4c..6578358adc03c636ee92121a8e97b89d14346d8f 100644 (file)
@@ -562,12 +562,12 @@ struct x_selection_request
 /* Stack of selections currently being processed.
    NULL if all requests have been fully processed.  */
 
-struct x_selection_request *selection_request_stack;
+static struct x_selection_request *selection_request_stack;
 
 /* List of all outstanding selection transfers which are currently
    being processed.  */
 
-struct transfer outstanding_transfers;
+static struct transfer outstanding_transfers;
 
 /* A counter for selection serials.  */
 
index 33ef18d8da5334c9a05cc4dba105455afad7844e..11ef9a4bd940b1a168652f626ba163642cd827f3 100644 (file)
@@ -971,7 +971,7 @@ struct x_selection_request_event
    selection requests inside long-lasting modal event loops, such as
    the drag-and-drop loop.  */
 
-struct x_selection_request_event *pending_selection_requests;
+static struct x_selection_request_event *pending_selection_requests;
 
 struct x_atom_ref
 {
@@ -1274,7 +1274,7 @@ static int x_dnd_waiting_for_motif_finish;
 
 /* The display the Motif drag receiver will send response data
    from.  */
-struct x_display_info *x_dnd_waiting_for_motif_finish_display;
+static struct x_display_info *x_dnd_waiting_for_motif_finish_display;
 
 /* Whether or not F1 was pressed during the drag-and-drop operation.
 
@@ -31921,8 +31921,6 @@ x_activate_timeout_atimer (void)
 \f
 /* Set up use of X before we make the first connection.  */
 
-extern frame_parm_handler x_frame_parm_handlers[];
-
 static struct redisplay_interface x_redisplay_interface =
   {
     x_frame_parm_handlers,
index 437ef281b0cbc54a7f8b51db809f61853f11ab37..bf402de326bdfaa33a0726907a03138bf17cadca 100644 (file)
@@ -1727,6 +1727,7 @@ SELECTION_EVENT_DISPLAY (struct selection_input_event *ev)
 
 /* From xfns.c.  */
 
+extern frame_parm_handler x_frame_parm_handlers[];
 extern void x_free_gcs (struct frame *);
 extern void x_relative_mouse_position (struct frame *, int *, int *);
 extern void x_real_pos_and_offsets (struct frame *, int *, int *, int *,