diff options
| author | Paul Eggert | 2016-09-30 12:14:04 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-09-30 12:38:52 -0700 |
| commit | f4eb8900295d75c4afec256f75aea22494376fde (patch) | |
| tree | 70203645e9b0b603ef8dbca6c50c01795a081512 | |
| parent | d1890a3a4a18f79cabf4caf8d194cdc29ea4bf05 (diff) | |
| download | emacs-f4eb8900295d75c4afec256f75aea22494376fde.tar.gz emacs-f4eb8900295d75c4afec256f75aea22494376fde.zip | |
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.
49 files changed, 71 insertions, 80 deletions
diff --git a/configure.ac b/configure.ac index 8479b0708f8..da577a3773f 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -4882,14 +4882,6 @@ AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", | |||
| 4882 | [Define to the canonical Emacs configuration name.]) | 4882 | [Define to the canonical Emacs configuration name.]) |
| 4883 | AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}", | 4883 | AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}", |
| 4884 | [Define to the options passed to configure.]) | 4884 | [Define to the options passed to configure.]) |
| 4885 | AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure | ||
| 4886 | define this to include extra configuration information.]) | ||
| 4887 | |||
| 4888 | case $opsys in | ||
| 4889 | mingw32) | ||
| 4890 | AC_DEFINE(config_opsysfile, <ms-w32.h>, []) | ||
| 4891 | ;; | ||
| 4892 | esac | ||
| 4893 | 4885 | ||
| 4894 | XMENU_OBJ= | 4886 | XMENU_OBJ= |
| 4895 | XOBJ= | 4887 | XOBJ= |
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 *); | |||
| 74 | #include <stdarg.h> | 74 | #include <stdarg.h> |
| 75 | #include <ctype.h> | 75 | #include <ctype.h> |
| 76 | #include <stdio.h> | 76 | #include <stdio.h> |
| 77 | #include <stdlib.h> | ||
| 77 | #include <getopt.h> | 78 | #include <getopt.h> |
| 78 | #include <unistd.h> | 79 | #include <unistd.h> |
| 79 | 80 | ||
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"; | |||
| 90 | 90 | ||
| 91 | #include <config.h> | 91 | #include <config.h> |
| 92 | 92 | ||
| 93 | #ifndef _GNU_SOURCE | ||
| 94 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ | ||
| 95 | #endif | ||
| 96 | |||
| 97 | /* WIN32_NATIVE is for XEmacs. | 93 | /* WIN32_NATIVE is for XEmacs. |
| 98 | MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ | 94 | MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ |
| 99 | #ifdef WIN32_NATIVE | 95 | #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/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | 23 | ||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 26 | #include <string.h> | ||
| 25 | #include <ctype.h> | 27 | #include <ctype.h> |
| 26 | 28 | ||
| 27 | #include <binary-io.h> | 29 | #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/>. */ | |||
| 37 | #include <config.h> | 37 | #include <config.h> |
| 38 | 38 | ||
| 39 | #include <stdarg.h> | 39 | #include <stdarg.h> |
| 40 | #include <stdbool.h> | ||
| 41 | #include <stddef.h> | 40 | #include <stddef.h> |
| 42 | #include <stdint.h> | 41 | #include <stdint.h> |
| 43 | #include <stdio.h> | 42 | #include <stdio.h> |
| 44 | #include <stdlib.h> /* config.h unconditionally includes this anyway */ | 43 | #include <stdlib.h> |
| 44 | #include <string.h> | ||
| 45 | 45 | ||
| 46 | #ifdef WINDOWSNT | 46 | #ifdef WINDOWSNT |
| 47 | /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this | 47 | /* 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/>. */ | |||
| 59 | #include <sys/types.h> | 59 | #include <sys/types.h> |
| 60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
| 61 | #include <sys/file.h> | 61 | #include <sys/file.h> |
| 62 | #include <stdbool.h> | ||
| 63 | #include <stdio.h> | 62 | #include <stdio.h> |
| 63 | #include <stdlib.h> | ||
| 64 | #include <errno.h> | 64 | #include <errno.h> |
| 65 | #include <time.h> | 65 | #include <time.h> |
| 66 | 66 | ||
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); | |||
| 63 | extern struct servent *hes_getservbyname (/* char *, char * */); | 63 | extern struct servent *hes_getservbyname (/* char *, char * */); |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #include <alloca.h> | ||
| 66 | #include <pwd.h> | 67 | #include <pwd.h> |
| 67 | #include <netdb.h> | 68 | #include <netdb.h> |
| 68 | #include <errno.h> | 69 | #include <errno.h> |
| 69 | #include <stdio.h> | 70 | #include <stdio.h> |
| 71 | #include <stdlib.h> | ||
| 70 | #include <string.h> | 72 | #include <string.h> |
| 71 | #include <unistd.h> | 73 | #include <unistd.h> |
| 72 | 74 | ||
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/>. */ | |||
| 35 | 35 | ||
| 36 | #include <inttypes.h> | 36 | #include <inttypes.h> |
| 37 | #include <stdio.h> | 37 | #include <stdio.h> |
| 38 | #include <stdlib.h> | ||
| 38 | 39 | ||
| 39 | #include <intprops.h> | 40 | #include <intprops.h> |
| 40 | #include <systime.h> | 41 | #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/>. */ | |||
| 37 | #include <errno.h> | 37 | #include <errno.h> |
| 38 | #include <inttypes.h> | 38 | #include <inttypes.h> |
| 39 | #include <limits.h> | 39 | #include <limits.h> |
| 40 | #include <stdbool.h> | ||
| 41 | #include <string.h> | 40 | #include <string.h> |
| 42 | #include <stdlib.h> | 41 | #include <stdlib.h> |
| 43 | #include <stdio.h> | 42 | #include <stdio.h> |
diff --git a/lib/openat-die.c b/lib/openat-die.c index f09123ea785..8dab8b97429 100644 --- a/lib/openat-die.c +++ b/lib/openat-die.c | |||
| @@ -2,5 +2,6 @@ | |||
| 2 | This should never happen with Emacs. */ | 2 | This should never happen with Emacs. */ |
| 3 | #include <config.h> | 3 | #include <config.h> |
| 4 | #include "openat.h" | 4 | #include "openat.h" |
| 5 | #include <stdlib.h> | ||
| 5 | void openat_save_fail (int errnum) { abort (); } | 6 | void openat_save_fail (int errnum) { abort (); } |
| 6 | void openat_restore_fail (int errnum) { abort (); } | 7 | void openat_restore_fail (int errnum) { abort (); } |
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index c92edd2f9e3..45faff8673a 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | 22 | ||
| 23 | #include <unistd.h> | 23 | #include <unistd.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #include <setjmp.h> | 26 | #include <setjmp.h> |
| 26 | 27 | ||
| 27 | #include <X11/StringDefs.h> | 28 | #include <X11/StringDefs.h> |
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index d1c5195dbf9..e66147f1fe3 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c | |||
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | 26 | ||
| 27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 28 | #include <stdio.h> | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> | ||
| 29 | #include "lwlib-int.h" | 30 | #include "lwlib-int.h" |
| 30 | #include "lwlib-utils.h" | 31 | #include "lwlib-utils.h" |
| 31 | #include <X11/StringDefs.h> | 32 | #include <X11/StringDefs.h> |
diff --git a/src/alloc.c b/src/alloc.c index 8dae6bffbd9..72987dd3190 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | 22 | ||
| 23 | #include <errno.h> | 23 | #include <errno.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #include <limits.h> /* For CHAR_BIT. */ | 26 | #include <limits.h> /* For CHAR_BIT. */ |
| 26 | #include <signal.h> /* For SIGABRT, SIGDANGER. */ | 27 | #include <signal.h> /* For SIGABRT, SIGDANGER. */ |
| 27 | 28 | ||
diff --git a/src/buffer.c b/src/buffer.c index 24c997fcdbd..3d205bb71ba 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | #include <sys/param.h> | 25 | #include <sys/param.h> |
| 26 | #include <errno.h> | 26 | #include <errno.h> |
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> | ||
| 28 | #include <unistd.h> | 29 | #include <unistd.h> |
| 29 | 30 | ||
| 30 | #include <verify.h> | 31 | #include <verify.h> |
diff --git a/src/callproc.c b/src/callproc.c index 454ed6d633c..8ed28556e0d 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <errno.h> | 23 | #include <errno.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #include <sys/types.h> | 26 | #include <sys/types.h> |
| 26 | #include <unistd.h> | 27 | #include <unistd.h> |
| 27 | 28 | ||
diff --git a/src/charset.c b/src/charset.c index cdbfe119515..ff937bc5a13 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | 30 | ||
| 31 | #include <errno.h> | 31 | #include <errno.h> |
| 32 | #include <stdio.h> | 32 | #include <stdio.h> |
| 33 | #include <stdlib.h> | ||
| 33 | #include <unistd.h> | 34 | #include <unistd.h> |
| 34 | #include <limits.h> | 35 | #include <limits.h> |
| 35 | #include <sys/types.h> | 36 | #include <sys/types.h> |
diff --git a/src/conf_post.h b/src/conf_post.h index 6d54524b970..9c544e89e94 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -18,22 +18,23 @@ GNU General Public License for more details. | |||
| 18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | /* Commentary: | 21 | /* Put the code here rather than in configure.ac using AH_BOTTOM. |
| 22 | This way, the code does not get processed by autoheader. For | ||
| 23 | example, undefs here are not commented out. | ||
| 22 | 24 | ||
| 23 | Rather than writing this code directly in AH_BOTTOM, we include it | 25 | To help make dependencies clearer elsewhere, this file typically |
| 24 | via this file. This is so that it does not get processed by | 26 | does not #include other files. The exceptions are first stdbool.h |
| 25 | autoheader. Eg, any undefs here would otherwise be commented out. | 27 | because it is unlikely to interfere with configuration and bool is |
| 26 | */ | 28 | such a core part of the C language, and second ms-w32.h (DOS_NT |
| 29 | only) because it historically was included here and changing that | ||
| 30 | would take some work. */ | ||
| 27 | 31 | ||
| 28 | /* Code: */ | 32 | #include <stdbool.h> |
| 29 | 33 | ||
| 30 | /* Include any platform specific configuration file. */ | 34 | #if defined DOS_NT && !defined DEFER_MS_W32_H |
| 31 | #ifdef config_opsysfile | 35 | # include <ms-w32.h> |
| 32 | # include config_opsysfile | ||
| 33 | #endif | 36 | #endif |
| 34 | 37 | ||
| 35 | #include <stdbool.h> | ||
| 36 | |||
| 37 | /* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later. | 38 | /* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later. |
| 38 | It can be used in a preprocessor expression. */ | 39 | It can be used in a preprocessor expression. */ |
| 39 | #ifndef __GNUC_MINOR__ | 40 | #ifndef __GNUC_MINOR__ |
| @@ -55,14 +56,6 @@ typedef unsigned int bool_bf; | |||
| 55 | typedef bool bool_bf; | 56 | typedef bool bool_bf; |
| 56 | #endif | 57 | #endif |
| 57 | 58 | ||
| 58 | #ifndef WINDOWSNT | ||
| 59 | /* On AIX 3 this must be included before any other include file. */ | ||
| 60 | #include <alloca.h> | ||
| 61 | #if ! HAVE_ALLOCA | ||
| 62 | # error "alloca not available on this machine" | ||
| 63 | #endif | ||
| 64 | #endif | ||
| 65 | |||
| 66 | /* Simulate __has_attribute on compilers that lack it. It is used only | 59 | /* Simulate __has_attribute on compilers that lack it. It is used only |
| 67 | on arguments like alloc_size that are handled in this simulation. */ | 60 | on arguments like alloc_size that are handled in this simulation. */ |
| 68 | #ifndef __has_attribute | 61 | #ifndef __has_attribute |
| @@ -239,9 +232,6 @@ extern void _DebPrint (const char *fmt, ...); | |||
| 239 | extern char *emacs_getenv_TZ (void); | 232 | extern char *emacs_getenv_TZ (void); |
| 240 | extern int emacs_setenv_TZ (char const *); | 233 | extern int emacs_setenv_TZ (char const *); |
| 241 | 234 | ||
| 242 | #include <string.h> | ||
| 243 | #include <stdlib.h> | ||
| 244 | |||
| 245 | #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ | 235 | #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ |
| 246 | #define NO_INLINE __attribute__((noinline)) | 236 | #define NO_INLINE __attribute__((noinline)) |
| 247 | #else | 237 | #else |
| @@ -365,5 +355,3 @@ extern int emacs_setenv_TZ (char const *); | |||
| 365 | #else | 355 | #else |
| 366 | # define UNINIT /* empty */ | 356 | # define UNINIT /* empty */ |
| 367 | #endif | 357 | #endif |
| 368 | |||
| 369 | /* conf_post.h ends here */ | ||
diff --git a/src/dbusbind.c b/src/dbusbind.c index 7a94c81eeab..a0146a3bf53 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #ifdef HAVE_DBUS | 21 | #ifdef HAVE_DBUS |
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> | ||
| 23 | #include <dbus/dbus.h> | 24 | #include <dbus/dbus.h> |
| 24 | 25 | ||
| 25 | #include "lisp.h" | 26 | #include "lisp.h" |
diff --git a/src/dispnew.c b/src/dispnew.c index 82d0b76a95f..70d4de07aac 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | 22 | ||
| 23 | #include "sysstdio.h" | 23 | #include "sysstdio.h" |
| 24 | #include <stdlib.h> | ||
| 24 | #include <unistd.h> | 25 | #include <unistd.h> |
| 25 | 26 | ||
| 26 | #include "lisp.h" | 27 | #include "lisp.h" |
diff --git a/src/doprnt.c b/src/doprnt.c index de2b89e1225..73380050059 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -103,6 +103,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 103 | 103 | ||
| 104 | #include <config.h> | 104 | #include <config.h> |
| 105 | #include <stdio.h> | 105 | #include <stdio.h> |
| 106 | #include <stdlib.h> | ||
| 106 | #include <float.h> | 107 | #include <float.h> |
| 107 | #include <unistd.h> | 108 | #include <unistd.h> |
| 108 | #include <limits.h> | 109 | #include <limits.h> |
diff --git a/src/editfns.c b/src/editfns.c index c5b177e41f2..0bcc439e50e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -49,6 +49,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 49 | #include <limits.h> | 49 | #include <limits.h> |
| 50 | 50 | ||
| 51 | #include <intprops.h> | 51 | #include <intprops.h> |
| 52 | #include <stdlib.h> | ||
| 52 | #include <strftime.h> | 53 | #include <strftime.h> |
| 53 | #include <verify.h> | 54 | #include <verify.h> |
| 54 | 55 | ||
diff --git a/src/emacs-module.c b/src/emacs-module.c index 0e755ef956b..5075263edff 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -21,11 +21,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include "emacs-module.h" | 22 | #include "emacs-module.h" |
| 23 | 23 | ||
| 24 | #include <stdbool.h> | ||
| 25 | #include <stddef.h> | 24 | #include <stddef.h> |
| 26 | #include <stdint.h> | 25 | #include <stdint.h> |
| 27 | #include <stdio.h> | 26 | #include <stdio.h> |
| 28 | #include <string.h> | ||
| 29 | 27 | ||
| 30 | #include "lisp.h" | 28 | #include "lisp.h" |
| 31 | #include "dynlib.h" | 29 | #include "dynlib.h" |
diff --git a/src/emacs.c b/src/emacs.c index 9b2300989fa..13378c4c3b0 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 24 | #include <errno.h> | 24 | #include <errno.h> |
| 25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
| 26 | #include <stdio.h> | 26 | #include <stdio.h> |
| 27 | #include <stdlib.h> | ||
| 27 | 28 | ||
| 28 | #include <sys/types.h> | 29 | #include <sys/types.h> |
| 29 | #include <sys/file.h> | 30 | #include <sys/file.h> |
diff --git a/src/eval.c b/src/eval.c index 407561082d1..2fedbf377cf 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <limits.h> | 23 | #include <limits.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #include "lisp.h" | 26 | #include "lisp.h" |
| 26 | #include "blockinput.h" | 27 | #include "blockinput.h" |
| 27 | #include "commands.h" | 28 | #include "commands.h" |
diff --git a/src/filelock.c b/src/filelock.c index bde34e2c6c2..a2e1df99f07 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -27,6 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
| 28 | #include <signal.h> | 28 | #include <signal.h> |
| 29 | #include <stdio.h> | 29 | #include <stdio.h> |
| 30 | #include <stdlib.h> | ||
| 30 | 31 | ||
| 31 | #ifdef HAVE_PWD_H | 32 | #ifdef HAVE_PWD_H |
| 32 | #include <pwd.h> | 33 | #include <pwd.h> |
| @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | 22 | ||
| 23 | #include <stdlib.h> | ||
| 23 | #include <unistd.h> | 24 | #include <unistd.h> |
| 24 | #include <filevercmp.h> | 25 | #include <filevercmp.h> |
| 25 | #include <intprops.h> | 26 | #include <intprops.h> |
diff --git a/src/font.c b/src/font.c index f2800633b62..cfbc5c7e266 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <float.h> | 24 | #include <float.h> |
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> | ||
| 26 | 27 | ||
| 27 | #include <c-ctype.h> | 28 | #include <c-ctype.h> |
| 28 | 29 | ||
diff --git a/src/fontset.c b/src/fontset.c index 67696d0fead..fe595d81a3e 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | 26 | ||
| 27 | #include <config.h> | 27 | #include <config.h> |
| 28 | #include <stdio.h> | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> | ||
| 29 | 30 | ||
| 30 | #include "lisp.h" | 31 | #include "lisp.h" |
| 31 | #include "blockinput.h" | 32 | #include "blockinput.h" |
diff --git a/src/frame.c b/src/frame.c index 42a01f57724..45559b0be98 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> | ||
| 23 | #include <errno.h> | 24 | #include <errno.h> |
| 24 | #include <limits.h> | 25 | #include <limits.h> |
| 25 | 26 | ||
diff --git a/src/keymap.c b/src/keymap.c index b27df1d0452..c4a59adff5b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -41,6 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | 41 | ||
| 42 | #include <config.h> | 42 | #include <config.h> |
| 43 | #include <stdio.h> | 43 | #include <stdio.h> |
| 44 | #include <stdlib.h> | ||
| 44 | 45 | ||
| 45 | #include "lisp.h" | 46 | #include "lisp.h" |
| 46 | #include "commands.h" | 47 | #include "commands.h" |
diff --git a/src/lisp.h b/src/lisp.h index f653d855dad..74308985f18 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -21,10 +21,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | #ifndef EMACS_LISP_H | 21 | #ifndef EMACS_LISP_H |
| 22 | #define EMACS_LISP_H | 22 | #define EMACS_LISP_H |
| 23 | 23 | ||
| 24 | #include <alloca.h> | ||
| 24 | #include <setjmp.h> | 25 | #include <setjmp.h> |
| 25 | #include <stdalign.h> | 26 | #include <stdalign.h> |
| 26 | #include <stdarg.h> | 27 | #include <stdarg.h> |
| 27 | #include <stddef.h> | 28 | #include <stddef.h> |
| 29 | #include <string.h> | ||
| 28 | #include <float.h> | 30 | #include <float.h> |
| 29 | #include <inttypes.h> | 31 | #include <inttypes.h> |
| 30 | #include <limits.h> | 32 | #include <limits.h> |
diff --git a/src/lread.c b/src/lread.c index d3413d16cea..10eec3b1be0 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | 23 | ||
| 24 | #include <config.h> | 24 | #include <config.h> |
| 25 | #include "sysstdio.h" | 25 | #include "sysstdio.h" |
| 26 | #include <stdlib.h> | ||
| 26 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 27 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
| 28 | #include <sys/file.h> | 29 | #include <sys/file.h> |
diff --git a/src/process.c b/src/process.c index 9a0ab00c505..8cf045ca9c2 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | 23 | ||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #include <errno.h> | 26 | #include <errno.h> |
| 26 | #include <sys/types.h> /* Some typedefs are used in sys/file.h. */ | 27 | #include <sys/types.h> /* Some typedefs are used in sys/file.h. */ |
| 27 | #include <sys/file.h> | 28 | #include <sys/file.h> |
diff --git a/src/regex.c b/src/regex.c index 41c1d3f6106..1917a8480ae 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <config.h> | 50 | #include <config.h> |
| 51 | 51 | ||
| 52 | #include <stddef.h> | 52 | #include <stddef.h> |
| 53 | #include <stdlib.h> | ||
| 53 | 54 | ||
| 54 | #ifdef emacs | 55 | #ifdef emacs |
| 55 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ | 56 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ |
| @@ -443,25 +444,12 @@ init_syntax_once (void) | |||
| 443 | 444 | ||
| 444 | #else /* not REGEX_MALLOC */ | 445 | #else /* not REGEX_MALLOC */ |
| 445 | 446 | ||
| 446 | /* Emacs already defines alloca, sometimes. */ | ||
| 447 | # ifndef alloca | ||
| 448 | |||
| 449 | /* Make alloca work the best possible way. */ | ||
| 450 | # ifdef __GNUC__ | ||
| 451 | # define alloca __builtin_alloca | ||
| 452 | # else /* not __GNUC__ */ | ||
| 453 | # ifdef HAVE_ALLOCA_H | ||
| 454 | # include <alloca.h> | ||
| 455 | # endif /* HAVE_ALLOCA_H */ | ||
| 456 | # endif /* not __GNUC__ */ | ||
| 457 | |||
| 458 | # endif /* not alloca */ | ||
| 459 | |||
| 460 | # ifdef emacs | 447 | # ifdef emacs |
| 461 | # define REGEX_USE_SAFE_ALLOCA USE_SAFE_ALLOCA | 448 | # define REGEX_USE_SAFE_ALLOCA USE_SAFE_ALLOCA |
| 462 | # define REGEX_SAFE_FREE() SAFE_FREE () | 449 | # define REGEX_SAFE_FREE() SAFE_FREE () |
| 463 | # define REGEX_ALLOCATE SAFE_ALLOCA | 450 | # define REGEX_ALLOCATE SAFE_ALLOCA |
| 464 | # else | 451 | # else |
| 452 | # include <alloca.h> | ||
| 465 | # define REGEX_ALLOCATE alloca | 453 | # define REGEX_ALLOCATE alloca |
| 466 | # endif | 454 | # endif |
| 467 | 455 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index 190d6fbe920..0121f01631c 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <grp.h> | 26 | #include <grp.h> |
| 27 | #endif /* HAVE_PWD_H */ | 27 | #endif /* HAVE_PWD_H */ |
| 28 | #include <limits.h> | 28 | #include <limits.h> |
| 29 | #include <stdlib.h> | ||
| 29 | #include <unistd.h> | 30 | #include <unistd.h> |
| 30 | 31 | ||
| 31 | #include <c-ctype.h> | 32 | #include <c-ctype.h> |
diff --git a/src/systty.h b/src/systty.h index fbdc6b18373..a53c874699f 100644 --- a/src/systty.h +++ b/src/systty.h | |||
| @@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <fcntl.h> | 26 | #include <fcntl.h> |
| 27 | #endif /* not DOS_NT */ | 27 | #endif /* not DOS_NT */ |
| 28 | 28 | ||
| 29 | #include <stdbool.h> | ||
| 30 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
| 31 | 30 | ||
| 32 | #ifdef HPUX | 31 | #ifdef HPUX |
diff --git a/src/term.c b/src/term.c index c22d07ac579..d691a7aa101 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include <errno.h> | 23 | #include <errno.h> |
| 24 | #include <fcntl.h> | 24 | #include <fcntl.h> |
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> | ||
| 26 | #include <sys/file.h> | 27 | #include <sys/file.h> |
| 27 | #include <sys/time.h> | 28 | #include <sys/time.h> |
| 28 | #include <unistd.h> | 29 | #include <unistd.h> |
diff --git a/src/unexcw.c b/src/unexcw.c index 6343b38bcff..c0d1bc176a5 100644 --- a/src/unexcw.c +++ b/src/unexcw.c | |||
| @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include "unexec.h" | 22 | #include "unexec.h" |
| 23 | #include "lisp.h" | 23 | #include "lisp.h" |
| 24 | #include <string.h> | ||
| 25 | #include <stdio.h> | 24 | #include <stdio.h> |
| 26 | #include <fcntl.h> | 25 | #include <fcntl.h> |
| 27 | #include <a.out.h> | 26 | #include <a.out.h> |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 185a9d1f62b..ea8e884f177 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -85,20 +85,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 85 | be changed accordingly. | 85 | be changed accordingly. |
| 86 | */ | 86 | */ |
| 87 | 87 | ||
| 88 | /* Enable GNU extensions in gnulib replacement headers. */ | ||
| 89 | #define _GNU_SOURCE 1 | ||
| 90 | |||
| 91 | /* config.h #define:s malloc/realloc/free and then includes stdlib.h. | ||
| 92 | We want the undefined versions, but if config.h includes stdlib.h | ||
| 93 | with the #define:s in place, the prototypes will be wrong and we get | ||
| 94 | warnings. To prevent that, include stdlib.h before config.h. */ | ||
| 95 | |||
| 96 | #include <stdlib.h> | ||
| 97 | #include <config.h> | 88 | #include <config.h> |
| 89 | |||
| 90 | /* Although <config.h> redefines malloc to unexec_malloc, etc., this | ||
| 91 | file wants stdlib.h to declare the originals. */ | ||
| 98 | #undef malloc | 92 | #undef malloc |
| 99 | #undef realloc | 93 | #undef realloc |
| 100 | #undef free | 94 | #undef free |
| 101 | 95 | ||
| 96 | #include <stdlib.h> | ||
| 97 | |||
| 102 | #include "unexec.h" | 98 | #include "unexec.h" |
| 103 | #include "lisp.h" | 99 | #include "lisp.h" |
| 104 | 100 | ||
| @@ -21,8 +21,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | Geoff Voelker (voelker@cs.washington.edu) 7-29-94 | 21 | Geoff Voelker (voelker@cs.washington.edu) 7-29-94 |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* Enable GNU extensions in gnulib replacement headers. */ | 24 | #define DEFER_MS_W32_H |
| 25 | #define _GNU_SOURCE 1 | 25 | #include <config.h> |
| 26 | 26 | ||
| 27 | #include <mingw_time.h> | 27 | #include <mingw_time.h> |
| 28 | #include <stddef.h> /* for offsetof */ | 28 | #include <stddef.h> /* for offsetof */ |
| @@ -40,9 +40,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 40 | #include <sys/utime.h> | 40 | #include <sys/utime.h> |
| 41 | #include <math.h> | 41 | #include <math.h> |
| 42 | 42 | ||
| 43 | /* must include CRT headers *before* config.h */ | 43 | /* Include CRT headers *before* ms-w32.h. */ |
| 44 | #include <ms-w32.h> | ||
| 44 | 45 | ||
| 45 | #include <config.h> | ||
| 46 | #include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ | 46 | #include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ |
| 47 | 47 | ||
| 48 | #undef access | 48 | #undef access |
diff --git a/src/w32notify.c b/src/w32notify.c index 15e8a86cf17..32a03f70a66 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -81,14 +81,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 81 | thread to exit. The main thread waits for some time for the worker | 81 | thread to exit. The main thread waits for some time for the worker |
| 82 | thread to exit, and if it doesn't, terminates it forcibly. */ | 82 | thread to exit, and if it doesn't, terminates it forcibly. */ |
| 83 | 83 | ||
| 84 | /* Enable GNU extensions in gnulib replacement headers. */ | 84 | #define DEFER_MS_W32_H |
| 85 | #define _GNU_SOURCE 1 | 85 | #include <config.h> |
| 86 | 86 | ||
| 87 | #include <stddef.h> | 87 | #include <stddef.h> |
| 88 | #include <errno.h> | 88 | #include <errno.h> |
| 89 | 89 | ||
| 90 | /* must include CRT headers *before* config.h */ | 90 | /* Include CRT headers *before* ms-w32.h. */ |
| 91 | #include <config.h> | 91 | #include <ms-w32.h> |
| 92 | 92 | ||
| 93 | #include <windows.h> | 93 | #include <windows.h> |
| 94 | 94 | ||
diff --git a/src/w32proc.c b/src/w32proc.c index e23b1b3563c..aef4e44d73a 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -22,8 +22,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | Adapted from alarm.c by Tim Fleehart | 22 | Adapted from alarm.c by Tim Fleehart |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | /* Enable GNU extensions in gnulib replacement headers. */ | 25 | #define DEFER_MS_W32_H |
| 26 | #define _GNU_SOURCE 1 | 26 | #include <config.h> |
| 27 | 27 | ||
| 28 | #include <mingw_time.h> | 28 | #include <mingw_time.h> |
| 29 | #include <stdio.h> | 29 | #include <stdio.h> |
| @@ -38,8 +38,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | #include <mbstring.h> | 38 | #include <mbstring.h> |
| 39 | #include <locale.h> | 39 | #include <locale.h> |
| 40 | 40 | ||
| 41 | /* must include CRT headers *before* config.h */ | 41 | /* Include CRT headers *before* ms-w32.h. */ |
| 42 | #include <config.h> | 42 | #include <ms-w32.h> |
| 43 | 43 | ||
| 44 | #undef signal | 44 | #undef signal |
| 45 | #undef wait | 45 | #undef wait |
diff --git a/src/widget.c b/src/widget.c index 28bb475ddfa..59ed431e23b 100644 --- a/src/widget.c +++ b/src/widget.c | |||
| @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include "widget.h" | 32 | #include "widget.h" |
| 33 | 33 | ||
| 34 | #include <stdio.h> | 34 | #include <stdio.h> |
| 35 | #include <stdlib.h> | ||
| 35 | 36 | ||
| 36 | #include "lisp.h" | 37 | #include "lisp.h" |
| 37 | #include "xterm.h" | 38 | #include "xterm.h" |
diff --git a/src/xdisp.c b/src/xdisp.c index 13af87f953c..e8061663f86 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -288,6 +288,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 288 | 288 | ||
| 289 | #include <config.h> | 289 | #include <config.h> |
| 290 | #include <stdio.h> | 290 | #include <stdio.h> |
| 291 | #include <stdlib.h> | ||
| 291 | #include <limits.h> | 292 | #include <limits.h> |
| 292 | 293 | ||
| 293 | #include "lisp.h" | 294 | #include "lisp.h" |
diff --git a/src/xfaces.c b/src/xfaces.c index 056f90cb7ac..5837f35d7b6 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -200,6 +200,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 200 | used to fill in unspecified attributes of the default face. */ | 200 | used to fill in unspecified attributes of the default face. */ |
| 201 | 201 | ||
| 202 | #include <config.h> | 202 | #include <config.h> |
| 203 | #include <stdlib.h> | ||
| 203 | #include "sysstdio.h" | 204 | #include "sysstdio.h" |
| 204 | #include <sys/types.h> | 205 | #include <sys/types.h> |
| 205 | #include <sys/stat.h> | 206 | #include <sys/stat.h> |
diff --git a/src/xfns.c b/src/xfns.c index dd39e782fac..8571d0e20ab 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | #include <stdio.h> | 21 | #include <stdio.h> |
| 22 | #include <stdlib.h> | ||
| 22 | #include <math.h> | 23 | #include <math.h> |
| 23 | #include <unistd.h> | 24 | #include <unistd.h> |
| 24 | 25 | ||
diff --git a/src/xfont.c b/src/xfont.c index 8fbe94c01ab..45b0e0a5f53 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> | ||
| 24 | #include <X11/Xlib.h> | 25 | #include <X11/Xlib.h> |
| 25 | 26 | ||
| 26 | #include "lisp.h" | 27 | #include "lisp.h" |
diff --git a/src/xgselect.c b/src/xgselect.c index ac88afdd54b..7850a16e9c0 100644 --- a/src/xgselect.c +++ b/src/xgselect.c | |||
| @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include <glib.h> | 26 | #include <glib.h> |
| 27 | #include <errno.h> | 27 | #include <errno.h> |
| 28 | #include <stdbool.h> | ||
| 29 | #include "blockinput.h" | 28 | #include "blockinput.h" |
| 30 | #include "systime.h" | 29 | #include "systime.h" |
| 31 | 30 | ||
diff --git a/src/xterm.c b/src/xterm.c index 4c14e62058f..747669446f5 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> | ||
| 25 | #ifdef USE_CAIRO | 26 | #ifdef USE_CAIRO |
| 26 | #include <math.h> | 27 | #include <math.h> |
| 27 | #endif | 28 | #endif |