summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-08-31 19:37:22 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-08-31 19:37:22 -0700
commit1564080f0b24551765d7068b9fc02f6e5a78fea3 (patch)
treec710c96b8aef1bdb16ae9287b5fd775695a8547c
parent56f9f0ab54fd752773d8bb371a4032e43c9c224c (diff)
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. * 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.
-rw-r--r--ChangeLog6
-rw-r--r--configure.ac11
-rw-r--r--src/ChangeLog16
-rw-r--r--src/bytecode.c5
-rw-r--r--src/emacs.c10
-rw-r--r--src/lastfile.c2
-rw-r--r--src/lisp.h6
-rw-r--r--src/regex.h3
-rw-r--r--src/unexcw.c4
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/unexw32.c3
-rw-r--r--src/vm-limit.c16
12 files changed, 50 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 18ded9664f..d3039bed1c 100644
--- 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.
diff --git a/configure.ac b/configure.ac
index 596fab64a0..912fac178e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/src/ChangeLog b/src/ChangeLog
index 26ee524acd..0bf0842690 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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
diff --git a/src/bytecode.c b/src/bytecode.c
index ca6681f21e..d3c8b470cc 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -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;
diff --git a/src/emacs.c b/src/emacs.c
index 0b52659172..9b05d68b91 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -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
diff --git a/src/lastfile.c b/src/lastfile.c
index a900e9541c..e7136e069d 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -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
diff --git a/src/lisp.h b/src/lisp.h
index d31c5ae50c..53d6cf8009 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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;
diff --git a/src/regex.h b/src/regex.h
index 1b064987eb..0e25723a85 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -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;
+
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
diff --git a/src/unexcw.c b/src/unexcw.c
index 72456b33ec..cdeb899fd3 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -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
*/
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 8cd80a7a54..ae34237a66 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -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;
diff --git a/src/unexw32.c b/src/unexw32.c
index 7cbd95a46f..95c805d09a 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -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"
diff --git a/src/vm-limit.c b/src/vm-limit.c
index 308613f7eb..015f3ee211 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -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;