1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-27 10:54:40 +00:00

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.
This commit is contained in:
Paul Eggert 2014-08-31 19:37:22 -07:00
parent 56f9f0ab54
commit 1564080f0b
12 changed files with 50 additions and 34 deletions

View File

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

View 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])

View 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

View 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;

View 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

View 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

View 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;

View 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;
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so

View 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
*/

View 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;

View 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"

View 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;