]> code.delx.au - gnu-emacs/commitdiff
Clean up extern decls a bit.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Sep 2014 02:37:22 +0000 (19:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Sep 2014 02:37:22 +0000 (19:37 -0700)
* configure.ac (WERROR_CFLAGS): Don't disable -Wnested-externs.
While we're at it, don't disable -Wlogical-op either.
* src/bytecode.c: Include blockinput.h and keyboard.h rather
than rolling their APIs by hand.
* src/emacs.c: Include regex.h and rely on its and lisp.h's API
rather than rolling them by hand.
* src/lastfile.c: Include lisp.h, to check this file's API.
* src/lisp.h (lisp_eval_depth, my_edata, my_endbss, my_endbss_static):
New decls.
* src/regex.h (re_max_failures): New decl.
* src/unexcw.c, src/unexmacosx.c, src/unexw32.c:
Rely on lisp.h's API rather than rolling it by hand.
* src/vm-limit.c (__after_morecore_hook, __morecore, real_morecore):
Declare at top level, to pacify GCC -Wnested-externs.

12 files changed:
ChangeLog
configure.ac
src/ChangeLog
src/bytecode.c
src/emacs.c
src/lastfile.c
src/lisp.h
src/regex.h
src/unexcw.c
src/unexmacosx.c
src/unexw32.c
src/vm-limit.c

index 18ded9664fad2c49dc122a94ba4e48b653bbc446..d3039bed1c77ca5721d8ee2c230816528d7bfa14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean up extern decls a bit.
+       * configure.ac (WERROR_CFLAGS): Don't disable -Wnested-externs.
+       While we're at it, don't disable -Wlogical-op either.
+
 2014-08-31  Paul Eggert  <eggert@cs.ucla.edu>
 
        * configure.ac (MAKE): Export it, for config.status.
index 596fab64a057c58510d90df7c82d79e804705574..912fac178e4d67056c0afe82dc17e3236ba8a7e0 100644 (file)
@@ -844,10 +844,8 @@ else
 
   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
   nw="$nw -Woverlength-strings"     # Not a problem these days
-  nw="$nw -Wlogical-op"             # any use of fwrite provokes this
   nw="$nw -Wformat-nonliteral"      # we do this a lot
-  nw="$nw -Wvla"                    # warnings in gettext.h
-  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
+  nw="$nw -Wvla"                    # Emacs uses <vla.h>.
   nw="$nw -Wswitch-default"         # Too many warnings for now
   nw="$nw -Winline"                 # OK to ignore 'inline'
   nw="$nw -Wjump-misses-init"       # We sometimes safely jump over init.
@@ -864,7 +862,8 @@ else
   # Emacs's use of alloca inhibits protecting the stack.
   nw="$nw -Wstack-protector"
 
-  # The following line should be removable at some point.
+  # Emacs's use of partly-pure functions such as CHECK_TYPE make this
+  # option problematic.
   nw="$nw -Wsuggest-attribute=pure"
 
   # This part is merely for shortening the command line,
@@ -891,10 +890,6 @@ else
   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
   gl_WARN_ADD([-Wno-format-nonliteral])
 
-  # In spite of excluding -Wlogical-op above, it is enabled, as of
-  # gcc 4.5.0 20090517.
-  gl_WARN_ADD([-Wno-logical-op])
-
   # More things that clang is unduly picky about.
   if test $emacs_cv_clang = yes; then
     gl_WARN_ADD([-Wno-format-extra-args])
index 26ee524acdacfac9301f6c0ff8155000b3017414..0bf0842690b6d45d7a33baee9d7f3e1e0703fb8c 100644 (file)
@@ -1,3 +1,19 @@
+2014-09-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean up extern decls a bit.
+       * bytecode.c: Include blockinput.h and keyboard.h rather
+       than rolling their APIs by hand.
+       * emacs.c: Include regex.h and rely on its and lisp.h's API
+       rather than rolling them by hand.
+       * lastfile.c: Include lisp.h, to check this file's API.
+       * lisp.h (lisp_eval_depth, my_edata, my_endbss, my_endbss_static):
+       New decls.
+       * regex.h (re_max_failures): New decl.
+       * unexcw.c, unexmacosx.c, unexw32.c:
+       Rely on lisp.h's API rather than rolling it by hand.
+       * vm-limit.c (__after_morecore_hook, __morecore, real_morecore):
+       Declare at top level, to pacify GCC -Wnested-externs.
+
 2014-08-31  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (get_glyph_string_clip_rects): Don't let the width of a
index ca6681f21e95d0dbde078cd498534dfc824e51d1..d3c8b470cc3dc070879dc44c8affd8b3314e6af5 100644 (file)
@@ -36,8 +36,10 @@ by Hallvard:
 #include <config.h>
 
 #include "lisp.h"
+#include "blockinput.h"
 #include "character.h"
 #include "buffer.h"
+#include "keyboard.h"
 #include "syntax.h"
 #include "window.h"
 
@@ -1106,9 +1108,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
          goto pushhandler;
        CASE (Bpushconditioncase): /* New in 24.4.  */
          {
-           extern EMACS_INT lisp_eval_depth;
-           extern int poll_suppress_count;
-           extern int interrupt_input_blocked;
            struct handler *c;
            Lisp_Object tag;
            int dest;
index 0b52659172c4d6cfa9bdce9eed1cae910a9b4c29..9b05d68b91421b7b5e1100d05974f500398715e9 100644 (file)
@@ -83,6 +83,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "charset.h"
 #include "composite.h"
 #include "dispextern.h"
+#include "regex.h"
 #include "syntax.h"
 #include "sysselect.h"
 #include "systime.h"
@@ -741,9 +742,6 @@ main (int argc, char **argv)
 #ifdef GNU_LINUX
   if (!initialized)
     {
-      extern char my_endbss[];
-      extern char *my_endbss_static;
-
       if (my_heap_start == 0)
         my_heap_start = sbrk (0);
 
@@ -872,7 +870,6 @@ main (int argc, char **argv)
       && !getrlimit (RLIMIT_STACK, &rlim))
     {
       long newlim;
-      extern size_t re_max_failures;
       /* Approximate the amount regex.c needs per unit of re_max_failures.  */
       int ratio = 20 * sizeof (char *);
       /* Then add 33% to cover the size of the smaller stacks that regex.c
@@ -2136,10 +2133,7 @@ You must run Emacs in batch mode in order to dump it.  */)
 #ifndef WINDOWSNT
   /* On Windows, this was done before dumping, and that once suffices.
      Meanwhile, my_edata is not valid on Windows.  */
-  {
-    extern char my_edata[];
-    memory_warnings (my_edata, malloc_warning);
-  }
+  memory_warnings (my_edata, malloc_warning);
 #endif /* not WINDOWSNT */
 #endif /* not SYSTEM_MALLOC and not HYBRID_MALLOC */
 #ifdef DOUG_LEA_MALLOC
index a900e9541c829dd6b6eecf7581e0e1e6156da8fa..e7136e069d00a74c5fdba4b8cc77e8fbcc4f34dd 100644 (file)
@@ -36,6 +36,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
+#include <lisp.h>
+
 char my_edata[] = "End of Emacs initialized data";
 
 /* Help unexec locate the end of the .bss area used by Emacs (which
index d31c5ae50c351076c90c7d2c70b18c16ba7af97b..53d6cf8009e580e565cd6a9d2659e774e29484f4 100644 (file)
@@ -3885,6 +3885,7 @@ intern_c_string (const char *str)
 }
 
 /* Defined in eval.c.  */
+extern EMACS_INT lisp_eval_depth;
 extern Lisp_Object Qexit, Qinteractive, Qcommandp, Qmacro;
 extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure;
 extern Lisp_Object Qand_rest;
@@ -4419,6 +4420,11 @@ extern void syms_of_profiler (void);
 extern char *emacs_root_dir (void);
 #endif /* DOS_NT */
 
+/* Defined in lastfile.c.  */
+extern char my_edata[];
+extern char my_endbss[];
+extern char *my_endbss_static;
+
 /* True means ^G can quit instantly.  */
 extern bool immediate_quit;
 
index 1b064987eb769316a5479e837ca26d6f14e1ebbd..0e25723a85ecabf6516e131b85a804b463f27897 100644 (file)
@@ -172,6 +172,9 @@ extern reg_syntax_t re_syntax_options;
 extern Lisp_Object re_match_object;
 #endif
 
+/* Roughly the maximum number of failure points on the stack.  */
+extern size_t re_max_failures;
+
 \f
 /* Define combinations of the above bits for the standard possibilities.
    (The [[[ comments delimit what gets put into the Texinfo file, so
index 72456b33ec4c1d062a429a29c14e7621460a219f..cdeb899fd30034c8ee6bb48b3da0ab5fe40d3fd8 100644 (file)
@@ -34,10 +34,6 @@ extern void report_sheap_usage (int);
 
 extern int bss_sbrk_did_unexec;
 
-/* emacs symbols that indicate where bss and data end for emacs internals */
-extern char my_endbss[];
-extern char my_edata[];
-
 /*
 ** header for Windows executable files
 */
index 8cd80a7a544a416a5d9cd66c144a630391334042..ae34237a66bd264a3b636b5ee2e563cc1c68c59e 100644 (file)
@@ -826,7 +826,6 @@ copy_data_segment (struct load_command *lc)
         file.  */
       if (strncmp (sectp->sectname, SECT_DATA, 16) == 0)
        {
-         extern char my_edata[];
          unsigned long my_size;
 
          /* The __data section is basically dumped from memory.  But
@@ -857,7 +856,6 @@ copy_data_segment (struct load_command *lc)
        }
       else if (strncmp (sectp->sectname, SECT_BSS, 16) == 0)
        {
-         extern char *my_endbss_static;
          unsigned long my_size;
 
          sectp->flags = S_REGULAR;
index 7cbd95a46fedd24b648fc97e29c04b39857219bc..95c805d09ae95658f81f28cb43a5247e821166ed 100644 (file)
@@ -43,11 +43,8 @@ PIMAGE_NT_HEADERS
 extern BOOL ctrl_c_handler (unsigned long type);
 
 extern char my_begdata[];
-extern char my_edata[];
 extern char my_begbss[];
-extern char my_endbss[];
 extern char *my_begbss_static;
-extern char *my_endbss_static;
 
 #include "w32heap.h"
 
index 308613f7eb40ba9f51ecf8b62f555cf641aa7ae6..015f3ee2111cc780e8b4a75ba34f0318dd720589 100644 (file)
@@ -51,6 +51,15 @@ char data_start[1] = { 1 };
 # endif
 #endif
 
+/* From gmalloc.c.  */
+extern void (* __after_morecore_hook) (void);
+extern void *(*__morecore) (ptrdiff_t);
+
+/* From ralloc.c.  */
+#ifdef REL_ALLOC
+extern void *(*real_morecore) (ptrdiff_t);
+#endif
+
 /*
   Level number of warnings already issued.
   0 -- no warnings issued.
@@ -130,12 +139,9 @@ ret_lim_data (void)
 static void
 check_memory_limits (void)
 {
-#ifdef REL_ALLOC
-  extern void *(*real_morecore) (ptrdiff_t);
-#else
+#ifndef REL_ALLOC
   void *(*real_morecore) (ptrdiff_t) = 0;
 #endif
-  extern void *(*__morecore) (ptrdiff_t);
 
   char *cp;
   size_t five_percent;
@@ -203,8 +209,6 @@ check_memory_limits (void)
 void
 memory_warnings (void *start, void (*warnfun) (const char *))
 {
-  extern void (* __after_morecore_hook) (void);     /* From gmalloc.c */
-
   data_space_start = start ? start : data_start;
 
   warn_function = warnfun;