diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-30 12:14:04 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-30 12:38:52 -0700 |
commit | f4eb8900295d75c4afec256f75aea22494376fde (patch) | |
tree | 70203645e9b0b603ef8dbca6c50c01795a081512 /lib-src | |
parent | d1890a3a4a18f79cabf4caf8d194cdc29ea4bf05 (diff) | |
download | emacs-f4eb8900295d75c4afec256f75aea22494376fde.tar.gz |
Limit <config.h>’s includes
This follows up on recent problems with the fact that config.h
includes stdlib.h etc.; some files need to include stdlib.h later.
config.h generally should limit itself to includes that are
universally safe; outside of MS-Windows, only stdbool.h makes
the cut among the files currently included. So, move the
other includes to just the files that need them (Bug#24506).
* configure.ac (config_opsysfile): Remove, as this generic hook
is no longer needed.
* lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
* src/w32proc.c (_GNU_SOURCE):
Remove, as it’s OK for config.h to do this now.
* src/conf_post.h: Include <ms-w32.h>, instead of the generic
config_opsysfile, for simplicity as this old way of configuring is
now done only for the MS-Windows port. Do not include <ms-w32.h>
if DEFER_MS_W32_H, for the benefit of the few files that want its
effects later. Do not include <alloca.h>, <string.h>, or
<stdlib.h>. Other files modified to include these headers as
needed, or to not include headers that are no longer needed.
* src/lisp.h: Include <alloca.h> and <string.h> here, since
some of the inline functions need them.
* src/regex.c: Include <alloca.h> if not emacs. (If emacs,
we can rely on SAFE_ALLOCA.) There is no longer any need to
worry about HAVE_ALLOCA_H.
* src/unexmacosx.c: Rely on config.h not including stdlib.h.
* src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
Define before including <config.h> first, and include <ms-w32.h>
after the troublesome headers.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/emacsclient.c | 1 | ||||
-rw-r--r-- | lib-src/etags.c | 4 | ||||
-rw-r--r-- | lib-src/hexl.c | 2 | ||||
-rw-r--r-- | lib-src/make-docfile.c | 4 | ||||
-rw-r--r-- | lib-src/movemail.c | 2 | ||||
-rw-r--r-- | lib-src/pop.c | 2 | ||||
-rw-r--r-- | lib-src/profile.c | 1 | ||||
-rw-r--r-- | lib-src/update-game-score.c | 1 |
8 files changed, 9 insertions, 8 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 458519d25fd..59b6ac97a05 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -74,6 +74,7 @@ char *w32_getenv (const char *); #include <stdarg.h> #include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <getopt.h> #include <unistd.h> diff --git a/lib-src/etags.c b/lib-src/etags.c index a81b46d2e07..0479f8e4ebd 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -90,10 +90,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #include <config.h> -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ -#endif - /* WIN32_NATIVE is for XEmacs. MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ #ifdef WIN32_NATIVE diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 9a5ca7e1543..5bd8579d258 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -22,6 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <ctype.h> #include <binary-io.h> diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index f463f13699b..9ba9b6e9af8 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -37,11 +37,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdarg.h> -#include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> /* config.h unconditionally includes this anyway */ +#include <stdlib.h> +#include <string.h> #ifdef WINDOWSNT /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 45779dae5c2..8111c8721bb 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -59,8 +59,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> -#include <stdbool.h> #include <stdio.h> +#include <stdlib.h> #include <errno.h> #include <time.h> diff --git a/lib-src/pop.c b/lib-src/pop.c index 99ec1cf824a..99424c584c2 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -63,10 +63,12 @@ void sys_freeaddrinfo (struct addrinfo * ai); extern struct servent *hes_getservbyname (/* char *, char * */); #endif +#include <alloca.h> #include <pwd.h> #include <netdb.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/lib-src/profile.c b/lib-src/profile.c index 0e603776049..edd36cafd37 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <inttypes.h> #include <stdio.h> +#include <stdlib.h> #include <intprops.h> #include <systime.h> diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 7675e9bdd4c..7e1b332bdcd 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -37,7 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <inttypes.h> #include <limits.h> -#include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> |