From unknown Sun Aug 17 01:58:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24506: [PROPOSED PATCH] Limit =?UTF-8?Q?=E2=80=99s?= includes Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Sep 2016 08:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24506 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 24506@debbugs.gnu.org Cc: Paul Eggert X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147453331826430 (code B ref -1); Thu, 22 Sep 2016 08:36:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Sep 2016 08:35:18 +0000 Received: from localhost ([127.0.0.1]:60168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmzTR-0006sD-Iz for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmzTM-0006rx-Ap for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmzT9-0004Q5-7k for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzT9-0004Pb-4I for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:34:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzSy-00053Y-Vw for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmzSp-0004Jg-Os for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:47 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzSl-0004Gh-LL for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:39 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4E09A161293 for ; Thu, 22 Sep 2016 01:34:21 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id MyezZkaFO26C; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 78C1416128F; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qgJKph5sRsAd; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4732E16117E; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) From: Paul Eggert Date: Thu, 22 Sep 2016 01:34:11 -0700 Message-Id: <1474533251-21751-1-git-send-email-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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. * 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=E2=80=99s OK for config.h to do this now. * src/conf_post.h: Include , 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 if DEFER_MS_W32_H, for the benefit of the few files that want its effects later. Do not include , , or . Other files modified to include these headers as needed, or to not include headers that are no longer needed. * src/lisp.h: Include and here, since some of the inline functions need them. * src/regex.c: Include 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 first, and include after the troublesome headers. --- configure.ac | 8 -------- lib-src/emacsclient.c | 1 + lib-src/etags.c | 4 ---- lib-src/hexl.c | 2 ++ lib-src/make-docfile.c | 4 ++-- lib-src/movemail.c | 2 +- lib-src/pop.c | 2 ++ lib-src/profile.c | 1 + lib-src/update-game-score.c | 1 - lib/openat-die.c | 1 + lwlib/lwlib-Xm.c | 1 + lwlib/lwlib.c | 1 + src/alloc.c | 1 + src/buffer.c | 1 + src/callproc.c | 1 + src/charset.c | 1 + src/conf_post.h | 36 ++++++++++++------------------------ src/dbusbind.c | 1 + src/dispnew.c | 1 + src/doprnt.c | 1 + src/editfns.c | 1 + src/emacs-module.c | 2 -- src/emacs.c | 1 + src/eval.c | 1 + src/filelock.c | 1 + src/fns.c | 1 + src/font.c | 1 + src/fontset.c | 1 + src/frame.c | 1 + src/keymap.c | 1 + src/lisp.h | 2 ++ src/lread.c | 1 + src/process.c | 1 + src/regex.c | 16 ++-------------- src/sysdep.c | 1 + src/systty.h | 1 - src/term.c | 1 + src/unexcw.c | 1 - src/unexmacosx.c | 14 +++++--------- src/w32.c | 8 ++++---- src/w32notify.c | 8 ++++---- src/w32proc.c | 8 ++++---- src/widget.c | 1 + src/xdisp.c | 1 + src/xfaces.c | 1 + src/xfns.c | 1 + src/xfont.c | 1 + src/xgselect.c | 1 - src/xterm.c | 1 + 49 files changed, 71 insertions(+), 80 deletions(-) diff --git a/configure.ac b/configure.ac index 6488f90..fe7f132 100644 --- a/configure.ac +++ b/configure.ac @@ -4882,14 +4882,6 @@ AC_DEFUN [Define to the canonical Emacs configuration name.]) AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}", [Define to the options passed to configure.]) -AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure - define this to include extra configuration information.]) - -case $opsys in - mingw32) - AC_DEFINE(config_opsysfile, , []) - ;; -esac =20 XMENU_OBJ=3D XOBJ=3D diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 458519d..59b6ac9 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -74,6 +74,7 @@ char *w32_getenv (const char *); #include #include #include +#include #include #include =20 diff --git a/lib-src/etags.c b/lib-src/etags.c index 3620b0f..6fdb063 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -90,10 +90,6 @@ char pot_etags_version[] =3D "@(#) pot revision number= is 17.38.1.4"; =20 #include =20 -#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 9a5ca7e..5bd8579 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -22,6 +22,8 @@ along with this program. If not, see . */ #include =20 #include +#include +#include #include =20 #include diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index f463f13..9ba9b6e 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -37,11 +37,11 @@ along with GNU Emacs. If not, see . */ #include =20 #include -#include #include #include #include -#include /* config.h unconditionally includes this anyway *= / +#include +#include =20 #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 45779da..8111c87 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -59,8 +59,8 @@ along with GNU Emacs. If not, see . */ #include #include #include -#include #include +#include #include #include =20 diff --git a/lib-src/pop.c b/lib-src/pop.c index 99ec1cf..99424c5 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 =20 +#include #include #include #include #include +#include #include #include =20 diff --git a/lib-src/profile.c b/lib-src/profile.c index 0e60377..edd36ca 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include #include diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 7675e9b..7e1b332 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 . */ #include #include #include -#include #include #include #include diff --git a/lib/openat-die.c b/lib/openat-die.c index f09123e..8dab8b9 100644 --- a/lib/openat-die.c +++ b/lib/openat-die.c @@ -2,5 +2,6 @@ This should never happen with Emacs. */ #include #include "openat.h" +#include void openat_save_fail (int errnum) { abort (); } void openat_restore_fail (int errnum) { abort (); } diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index c92edd2..45faff8 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index d1c5195..e66147f 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include "lwlib-int.h" #include "lwlib-utils.h" #include diff --git a/src/alloc.c b/src/alloc.c index 41b2f9e..cbfc0dc 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include /* For CHAR_BIT. */ #include /* For SIGABRT, SIGDANGER. */ =20 diff --git a/src/buffer.c b/src/buffer.c index 24c997f..3d205bb 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include =20 #include diff --git a/src/callproc.c b/src/callproc.c index 454ed6d..8ed2855 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include =20 diff --git a/src/charset.c b/src/charset.c index 0c831f1..14d976a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include #include diff --git a/src/conf_post.h b/src/conf_post.h index 6d54524..c0993a3 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -18,22 +18,23 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ =20 -/* Commentary: +/* Put the code here rather than in configure.ac using AH_BOTTOM. + This way, the code does not get processed by autoheader. For + example, undefs here are not commented out. =20 - Rather than writing this code directly in AH_BOTTOM, we include it - via this file. This is so that it does not get processed by - autoheader. Eg, any undefs here would otherwise be commented out. -*/ + To help make dependencies clearer elsewhere, this file typically + does not #include other files. The exceptions are first stdbool.h + because it is unlikely to interfere with configuration and bool is + such a core part of the C language, and second ms-w32.h (DOS_NT + only) because it historically was included here and changing that + would take some work. */ =20 -/* Code: */ +#include =20 -/* Include any platform specific configuration file. */ -#ifdef config_opsysfile -# include config_opsysfile +#if defined DOS_NT && !DEFER_MS_W32_H +# include #endif =20 -#include - /* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later= . It can be used in a preprocessor expression. */ #ifndef __GNUC_MINOR__ @@ -55,14 +56,6 @@ typedef unsigned int bool_bf; typedef bool bool_bf; #endif =20 -#ifndef WINDOWSNT -/* On AIX 3 this must be included before any other include file. */ -#include -#if ! HAVE_ALLOCA -# error "alloca not available on this machine" -#endif -#endif - /* Simulate __has_attribute on compilers that lack it. It is used only on arguments like alloc_size that are handled in this simulation. */ #ifndef __has_attribute @@ -239,9 +232,6 @@ extern void _DebPrint (const char *fmt, ...); extern char *emacs_getenv_TZ (void); extern int emacs_setenv_TZ (char const *); =20 -#include -#include - #if __GNUC__ >=3D 3 /* On GCC 3.0 we might get a warning. */ #define NO_INLINE __attribute__((noinline)) #else @@ -365,5 +355,3 @@ extern int emacs_setenv_TZ (char const *); #else # define UNINIT /* empty */ #endif - -/* conf_post.h ends here */ diff --git a/src/dbusbind.c b/src/dbusbind.c index 7a94c81..a0146a3 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ =20 #ifdef HAVE_DBUS #include +#include #include =20 #include "lisp.h" diff --git a/src/dispnew.c b/src/dispnew.c index 82d0b76..70d4de0 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include "sysstdio.h" +#include #include =20 #include "lisp.h" diff --git a/src/doprnt.c b/src/doprnt.c index 9d8b783..44a75f8 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -103,6 +103,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include #include diff --git a/src/editfns.c b/src/editfns.c index 835e432..8f6fc80 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -49,6 +49,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include =20 diff --git a/src/emacs-module.c b/src/emacs-module.c index 724d24a..0535a34 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -21,11 +21,9 @@ along with GNU Emacs. If not, see . */ =20 #include "emacs-module.h" =20 -#include #include #include #include -#include =20 #include "lisp.h" #include "dynlib.h" diff --git a/src/emacs.c b/src/emacs.c index 9b23009..13378c4 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #include #include diff --git a/src/eval.c b/src/eval.c index e08a25a..abc42a1 100644 --- a/src/eval.c +++ b/src/eval.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include "lisp.h" #include "blockinput.h" #include "commands.h" diff --git a/src/filelock.c b/src/filelock.c index bde34e2..a2e1df9 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -27,6 +27,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #ifdef HAVE_PWD_H #include diff --git a/src/fns.c b/src/fns.c index 31f0fd2..4f12dd5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ =20 #include =20 +#include #include #include #include diff --git a/src/font.c b/src/font.c index 144ba07..89f7c8e 100644 --- a/src/font.c +++ b/src/font.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #include =20 diff --git a/src/fontset.c b/src/fontset.c index 67696d0..fe595d8 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include "lisp.h" #include "blockinput.h" diff --git a/src/frame.c b/src/frame.c index 166623c..8831b9a 100644 --- a/src/frame.c +++ b/src/frame.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include =20 diff --git a/src/keymap.c b/src/keymap.c index b27df1d..c4a59ad 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -41,6 +41,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include "lisp.h" #include "commands.h" diff --git a/src/lisp.h b/src/lisp.h index f653d85..7430898 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -21,10 +21,12 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_LISP_H #define EMACS_LISP_H =20 +#include #include #include #include #include +#include #include #include #include diff --git a/src/lread.c b/src/lread.c index dc7c00b..d5e0460 100644 --- a/src/lread.c +++ b/src/lread.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include "sysstdio.h" +#include #include #include #include diff --git a/src/process.c b/src/process.c index 29bf43e..d77c5bf 100644 --- a/src/process.c +++ b/src/process.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include /* Some typedefs are used in sys/file.h. */ #include diff --git a/src/regex.c b/src/regex.c index 41c1d3f..1917a84 100644 --- a/src/regex.c +++ b/src/regex.c @@ -50,6 +50,7 @@ #include =20 #include +#include =20 #ifdef emacs /* We need this for `regex.h', and perhaps for the Emacs include files. = */ @@ -443,25 +444,12 @@ init_syntax_once (void) =20 #else /* not REGEX_MALLOC */ =20 -/* Emacs already defines alloca, sometimes. */ -# ifndef alloca - -/* Make alloca work the best possible way. */ -# ifdef __GNUC__ -# define alloca __builtin_alloca -# else /* not __GNUC__ */ -# ifdef HAVE_ALLOCA_H -# include -# endif /* HAVE_ALLOCA_H */ -# endif /* not __GNUC__ */ - -# endif /* not alloca */ - # ifdef emacs # define REGEX_USE_SAFE_ALLOCA USE_SAFE_ALLOCA # define REGEX_SAFE_FREE() SAFE_FREE () # define REGEX_ALLOCATE SAFE_ALLOCA # else +# include # define REGEX_ALLOCATE alloca # endif =20 diff --git a/src/sysdep.c b/src/sysdep.c index 190d6fbe..0121f01 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ #include #endif /* HAVE_PWD_H */ #include +#include #include =20 #include diff --git a/src/systty.h b/src/systty.h index fbdc6b1..a53c874 100644 --- a/src/systty.h +++ b/src/systty.h @@ -26,7 +26,6 @@ along with GNU Emacs. If not, see . */ #include #endif /* not DOS_NT */ =20 -#include #include =20 #ifdef HPUX diff --git a/src/term.c b/src/term.c index c22d07a..d691a7a 100644 --- a/src/term.c +++ b/src/term.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include #include diff --git a/src/unexcw.c b/src/unexcw.c index 6343b38..c0d1bc1 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include "unexec.h" #include "lisp.h" -#include #include #include #include diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 185a9d1..ea8e884 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -85,20 +85,16 @@ along with GNU Emacs. If not, see . */ be changed accordingly. */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 - -/* config.h #define:s malloc/realloc/free and then includes stdlib.h. - We want the undefined versions, but if config.h includes stdlib.h - with the #define:s in place, the prototypes will be wrong and we get - warnings. To prevent that, include stdlib.h before config.h. */ - -#include #include + +/* Although redefines malloc to unexec_malloc, etc., this + file wants stdlib.h to declare the originals. */ #undef malloc #undef realloc #undef free =20 +#include + #include "unexec.h" #include "lisp.h" =20 diff --git a/src/w32.c b/src/w32.c index 6cb8e74..e0a3406 100644 --- a/src/w32.c +++ b/src/w32.c @@ -21,8 +21,8 @@ along with GNU Emacs. If not, see . */ Geoff Voelker (voelker@cs.washington.edu) 7-2= 9-94 */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include /* for offsetof */ @@ -40,9 +40,9 @@ along with GNU Emacs. If not, see . */ #include #include =20 -/* must include CRT headers *before* config.h */ +/* Include CRT headers *before* ms-w32.h. */ +#include =20 -#include #include /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ =20 #undef access diff --git a/src/w32notify.c b/src/w32notify.c index 15e8a86..32a03f7 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -81,14 +81,14 @@ along with GNU Emacs. If not, see . */ thread to exit. The main thread waits for some time for the worker thread to exit, and if it doesn't, terminates it forcibly. */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include =20 -/* must include CRT headers *before* config.h */ -#include +/* Include CRT headers *before* ms-w32.h. */ +#include =20 #include =20 diff --git a/src/w32proc.c b/src/w32proc.c index e23b1b3..aef4e44 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -22,8 +22,8 @@ along with GNU Emacs. If not, see . */ Adapted from alarm.c by Tim Fleehart */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include @@ -38,8 +38,8 @@ along with GNU Emacs. If not, see . */ #include #include =20 -/* must include CRT headers *before* config.h */ -#include +/* Include CRT headers *before* ms-w32.h. */ +#include =20 #undef signal #undef wait diff --git a/src/widget.c b/src/widget.c index 28bb475..59ed431 100644 --- a/src/widget.c +++ b/src/widget.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ #include "widget.h" =20 #include +#include =20 #include "lisp.h" #include "xterm.h" diff --git a/src/xdisp.c b/src/xdisp.c index 4bf1470..67d14c8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -288,6 +288,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include "lisp.h" diff --git a/src/xfaces.c b/src/xfaces.c index 056f90c..5837f35 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -200,6 +200,7 @@ along with GNU Emacs. If not, see . */ used to fill in unspecified attributes of the default face. */ =20 #include +#include #include "sysstdio.h" #include #include diff --git a/src/xfns.c b/src/xfns.c index dd39e78..8571d0e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include =20 diff --git a/src/xfont.c b/src/xfont.c index 8fbe94c..45b0e0a 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include "lisp.h" diff --git a/src/xgselect.c b/src/xgselect.c index ac88afd..7850a16 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see . */ =20 #include #include -#include #include "blockinput.h" #include "systime.h" =20 diff --git a/src/xterm.c b/src/xterm.c index 4c14e62..7476694 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #ifdef USE_CAIRO #include #endif --=20 2.7.4 From unknown Sun Aug 17 01:58:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24506: Limit =?UTF-8?Q?=E2=80=99s?= includes In-Reply-To: <1474533251-21751-1-git-send-email-eggert@cs.ucla.edu> Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Sep 2016 17:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24506 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 24506@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147456522420573 (code B ref -1); Thu, 22 Sep 2016 17:28:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Sep 2016 17:27:04 +0000 Received: from localhost ([127.0.0.1]:60888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bn7m4-0005Ll-DW for submit@debbugs.gnu.org; Thu, 22 Sep 2016 13:27:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50261) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bn7m3-0005LJ-Em for submit@debbugs.gnu.org; Thu, 22 Sep 2016 13:27:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn7lx-0007Xn-HE for submit@debbugs.gnu.org; Thu, 22 Sep 2016 13:26:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn7lx-0007W2-Ea for submit@debbugs.gnu.org; Thu, 22 Sep 2016 13:26:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn7lv-0003F4-B0 for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 13:26:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn7ls-0007Qe-64 for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 13:26:55 -0400 Received: from [195.159.176.226] (port=45489 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn7lr-0007Jh-M4 for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 13:26:52 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bn7lX-0000YU-Fk for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 19:26:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Thu, 22 Sep 2016 18:26:19 +0100 Lines: 18 Message-ID: References: <1474533251-21751-1-git-send-email-eggert@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (windows-nt) Cancel-Lock: sha1:Y+lWBu4JYW49DjRWqNSF2Sd5CIw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On Thu 22 Sep 2016, Paul Eggert wrote: > 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. The check at the top of src/conf_post.h needs a minor fix: #if defined DOS_NT && !defined DEFER_MS_W32_H After that, it bootstraps on Windows using 64bit MSYS2 (gcc 6.2.0) and appears to be functional. AndyM From unknown Sun Aug 17 01:58:31 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Eggert Subject: bug#24506: closed (Re: bug#24506: Limit =?UTF-8?Q?=E2=80=99s?= includes) Message-ID: References: <1ef37b3a-1198-14c0-caa5-06711f566d56@cs.ucla.edu> <1474533251-21751-1-git-send-email-eggert@cs.ucla.edu> X-Gnu-PR-Message: they-closed 24506 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 24506@debbugs.gnu.org Date: Fri, 30 Sep 2016 19:44:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1475264642-7386-1" This is a multi-part message in MIME format... ------------=_1475264642-7386-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24506: [PROPOSED PATCH] Limit =E2=80=99s includes which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24506@debbugs.gnu.org. --=20 24506: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24506 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1475264642-7386-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24506-done) by debbugs.gnu.org; 30 Sep 2016 19:43:59 +0000 Received: from localhost ([127.0.0.1]:39980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bq3iw-0001un-NH for submit@debbugs.gnu.org; Fri, 30 Sep 2016 15:43:58 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bq3it-0001uY-U1 for 24506-done@debbugs.gnu.org; Fri, 30 Sep 2016 15:43:56 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E77D1161290; Fri, 30 Sep 2016 12:43:49 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id R-AWSRpobDku; Fri, 30 Sep 2016 12:43:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BD36716128F; Fri, 30 Sep 2016 12:43:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id W8_Xk-zkqL-2; Fri, 30 Sep 2016 12:43:48 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A724A16128C; Fri, 30 Sep 2016 12:43:48 -0700 (PDT) To: Andy Moreton From: Paul Eggert Subject: =?UTF-8?Q?Re:_bug#24506:_Limit_=e2=80=99s_includes?= Organization: UCLA Computer Science Department Message-ID: <1ef37b3a-1198-14c0-caa5-06711f566d56@cs.ucla.edu> Date: Fri, 30 Sep 2016 12:43:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 24506-done Cc: 24506-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) Thanks for checking it on MSYS2. I made the change you suggested, installed the resulting patch, and am marking this as done. In I proposed also changing conf_post.h to conf-post.h as per the usual GNU file name conventions. I'll wait a bit on this, as I want to shake out any problems with the main patch first. ------------=_1475264642-7386-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Sep 2016 08:35:18 +0000 Received: from localhost ([127.0.0.1]:60168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmzTR-0006sD-Iz for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmzTM-0006rx-Ap for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmzT9-0004Q5-7k for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:35:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzT9-0004Pb-4I for submit@debbugs.gnu.org; Thu, 22 Sep 2016 04:34:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzSy-00053Y-Vw for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmzSp-0004Jg-Os for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:47 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzSl-0004Gh-LL for bug-gnu-emacs@gnu.org; Thu, 22 Sep 2016 04:34:39 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4E09A161293 for ; Thu, 22 Sep 2016 01:34:21 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id MyezZkaFO26C; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 78C1416128F; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qgJKph5sRsAd; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4732E16117E; Thu, 22 Sep 2016 01:34:18 -0700 (PDT) From: Paul Eggert To: bug-gnu-emacs@gnu.org Subject: [PROPOSED PATCH] =?UTF-8?q?Limit=20=E2=80=99s=20include?= =?UTF-8?q?s?= Date: Thu, 22 Sep 2016 01:34:11 -0700 Message-Id: <1474533251-21751-1-git-send-email-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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. * 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=E2=80=99s OK for config.h to do this now. * src/conf_post.h: Include , 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 if DEFER_MS_W32_H, for the benefit of the few files that want its effects later. Do not include , , or . Other files modified to include these headers as needed, or to not include headers that are no longer needed. * src/lisp.h: Include and here, since some of the inline functions need them. * src/regex.c: Include 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 first, and include after the troublesome headers. --- configure.ac | 8 -------- lib-src/emacsclient.c | 1 + lib-src/etags.c | 4 ---- lib-src/hexl.c | 2 ++ lib-src/make-docfile.c | 4 ++-- lib-src/movemail.c | 2 +- lib-src/pop.c | 2 ++ lib-src/profile.c | 1 + lib-src/update-game-score.c | 1 - lib/openat-die.c | 1 + lwlib/lwlib-Xm.c | 1 + lwlib/lwlib.c | 1 + src/alloc.c | 1 + src/buffer.c | 1 + src/callproc.c | 1 + src/charset.c | 1 + src/conf_post.h | 36 ++++++++++++------------------------ src/dbusbind.c | 1 + src/dispnew.c | 1 + src/doprnt.c | 1 + src/editfns.c | 1 + src/emacs-module.c | 2 -- src/emacs.c | 1 + src/eval.c | 1 + src/filelock.c | 1 + src/fns.c | 1 + src/font.c | 1 + src/fontset.c | 1 + src/frame.c | 1 + src/keymap.c | 1 + src/lisp.h | 2 ++ src/lread.c | 1 + src/process.c | 1 + src/regex.c | 16 ++-------------- src/sysdep.c | 1 + src/systty.h | 1 - src/term.c | 1 + src/unexcw.c | 1 - src/unexmacosx.c | 14 +++++--------- src/w32.c | 8 ++++---- src/w32notify.c | 8 ++++---- src/w32proc.c | 8 ++++---- src/widget.c | 1 + src/xdisp.c | 1 + src/xfaces.c | 1 + src/xfns.c | 1 + src/xfont.c | 1 + src/xgselect.c | 1 - src/xterm.c | 1 + 49 files changed, 71 insertions(+), 80 deletions(-) diff --git a/configure.ac b/configure.ac index 6488f90..fe7f132 100644 --- a/configure.ac +++ b/configure.ac @@ -4882,14 +4882,6 @@ AC_DEFUN [Define to the canonical Emacs configuration name.]) AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}", [Define to the options passed to configure.]) -AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure - define this to include extra configuration information.]) - -case $opsys in - mingw32) - AC_DEFINE(config_opsysfile, , []) - ;; -esac =20 XMENU_OBJ=3D XOBJ=3D diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 458519d..59b6ac9 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -74,6 +74,7 @@ char *w32_getenv (const char *); #include #include #include +#include #include #include =20 diff --git a/lib-src/etags.c b/lib-src/etags.c index 3620b0f..6fdb063 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -90,10 +90,6 @@ char pot_etags_version[] =3D "@(#) pot revision number= is 17.38.1.4"; =20 #include =20 -#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 9a5ca7e..5bd8579 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -22,6 +22,8 @@ along with this program. If not, see . */ #include =20 #include +#include +#include #include =20 #include diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index f463f13..9ba9b6e 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -37,11 +37,11 @@ along with GNU Emacs. If not, see . */ #include =20 #include -#include #include #include #include -#include /* config.h unconditionally includes this anyway *= / +#include +#include =20 #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 45779da..8111c87 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -59,8 +59,8 @@ along with GNU Emacs. If not, see . */ #include #include #include -#include #include +#include #include #include =20 diff --git a/lib-src/pop.c b/lib-src/pop.c index 99ec1cf..99424c5 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 =20 +#include #include #include #include #include +#include #include #include =20 diff --git a/lib-src/profile.c b/lib-src/profile.c index 0e60377..edd36ca 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include #include diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 7675e9b..7e1b332 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 . */ #include #include #include -#include #include #include #include diff --git a/lib/openat-die.c b/lib/openat-die.c index f09123e..8dab8b9 100644 --- a/lib/openat-die.c +++ b/lib/openat-die.c @@ -2,5 +2,6 @@ This should never happen with Emacs. */ #include #include "openat.h" +#include void openat_save_fail (int errnum) { abort (); } void openat_restore_fail (int errnum) { abort (); } diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index c92edd2..45faff8 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index d1c5195..e66147f 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include "lwlib-int.h" #include "lwlib-utils.h" #include diff --git a/src/alloc.c b/src/alloc.c index 41b2f9e..cbfc0dc 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include /* For CHAR_BIT. */ #include /* For SIGABRT, SIGDANGER. */ =20 diff --git a/src/buffer.c b/src/buffer.c index 24c997f..3d205bb 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include =20 #include diff --git a/src/callproc.c b/src/callproc.c index 454ed6d..8ed2855 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include =20 diff --git a/src/charset.c b/src/charset.c index 0c831f1..14d976a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include #include diff --git a/src/conf_post.h b/src/conf_post.h index 6d54524..c0993a3 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -18,22 +18,23 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ =20 -/* Commentary: +/* Put the code here rather than in configure.ac using AH_BOTTOM. + This way, the code does not get processed by autoheader. For + example, undefs here are not commented out. =20 - Rather than writing this code directly in AH_BOTTOM, we include it - via this file. This is so that it does not get processed by - autoheader. Eg, any undefs here would otherwise be commented out. -*/ + To help make dependencies clearer elsewhere, this file typically + does not #include other files. The exceptions are first stdbool.h + because it is unlikely to interfere with configuration and bool is + such a core part of the C language, and second ms-w32.h (DOS_NT + only) because it historically was included here and changing that + would take some work. */ =20 -/* Code: */ +#include =20 -/* Include any platform specific configuration file. */ -#ifdef config_opsysfile -# include config_opsysfile +#if defined DOS_NT && !DEFER_MS_W32_H +# include #endif =20 -#include - /* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later= . It can be used in a preprocessor expression. */ #ifndef __GNUC_MINOR__ @@ -55,14 +56,6 @@ typedef unsigned int bool_bf; typedef bool bool_bf; #endif =20 -#ifndef WINDOWSNT -/* On AIX 3 this must be included before any other include file. */ -#include -#if ! HAVE_ALLOCA -# error "alloca not available on this machine" -#endif -#endif - /* Simulate __has_attribute on compilers that lack it. It is used only on arguments like alloc_size that are handled in this simulation. */ #ifndef __has_attribute @@ -239,9 +232,6 @@ extern void _DebPrint (const char *fmt, ...); extern char *emacs_getenv_TZ (void); extern int emacs_setenv_TZ (char const *); =20 -#include -#include - #if __GNUC__ >=3D 3 /* On GCC 3.0 we might get a warning. */ #define NO_INLINE __attribute__((noinline)) #else @@ -365,5 +355,3 @@ extern int emacs_setenv_TZ (char const *); #else # define UNINIT /* empty */ #endif - -/* conf_post.h ends here */ diff --git a/src/dbusbind.c b/src/dbusbind.c index 7a94c81..a0146a3 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ =20 #ifdef HAVE_DBUS #include +#include #include =20 #include "lisp.h" diff --git a/src/dispnew.c b/src/dispnew.c index 82d0b76..70d4de0 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include "sysstdio.h" +#include #include =20 #include "lisp.h" diff --git a/src/doprnt.c b/src/doprnt.c index 9d8b783..44a75f8 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -103,6 +103,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include #include diff --git a/src/editfns.c b/src/editfns.c index 835e432..8f6fc80 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -49,6 +49,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include =20 diff --git a/src/emacs-module.c b/src/emacs-module.c index 724d24a..0535a34 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -21,11 +21,9 @@ along with GNU Emacs. If not, see . */ =20 #include "emacs-module.h" =20 -#include #include #include #include -#include =20 #include "lisp.h" #include "dynlib.h" diff --git a/src/emacs.c b/src/emacs.c index 9b23009..13378c4 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #include #include diff --git a/src/eval.c b/src/eval.c index e08a25a..abc42a1 100644 --- a/src/eval.c +++ b/src/eval.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include "lisp.h" #include "blockinput.h" #include "commands.h" diff --git a/src/filelock.c b/src/filelock.c index bde34e2..a2e1df9 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -27,6 +27,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #ifdef HAVE_PWD_H #include diff --git a/src/fns.c b/src/fns.c index 31f0fd2..4f12dd5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ =20 #include =20 +#include #include #include #include diff --git a/src/font.c b/src/font.c index 144ba07..89f7c8e 100644 --- a/src/font.c +++ b/src/font.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include =20 #include =20 diff --git a/src/fontset.c b/src/fontset.c index 67696d0..fe595d8 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include "lisp.h" #include "blockinput.h" diff --git a/src/frame.c b/src/frame.c index 166623c..8831b9a 100644 --- a/src/frame.c +++ b/src/frame.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include =20 diff --git a/src/keymap.c b/src/keymap.c index b27df1d..c4a59ad 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -41,6 +41,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include =20 #include "lisp.h" #include "commands.h" diff --git a/src/lisp.h b/src/lisp.h index f653d85..7430898 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -21,10 +21,12 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_LISP_H #define EMACS_LISP_H =20 +#include #include #include #include #include +#include #include #include #include diff --git a/src/lread.c b/src/lread.c index dc7c00b..d5e0460 100644 --- a/src/lread.c +++ b/src/lread.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include "sysstdio.h" +#include #include #include #include diff --git a/src/process.c b/src/process.c index 29bf43e..d77c5bf 100644 --- a/src/process.c +++ b/src/process.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include =20 #include +#include #include #include /* Some typedefs are used in sys/file.h. */ #include diff --git a/src/regex.c b/src/regex.c index 41c1d3f..1917a84 100644 --- a/src/regex.c +++ b/src/regex.c @@ -50,6 +50,7 @@ #include =20 #include +#include =20 #ifdef emacs /* We need this for `regex.h', and perhaps for the Emacs include files. = */ @@ -443,25 +444,12 @@ init_syntax_once (void) =20 #else /* not REGEX_MALLOC */ =20 -/* Emacs already defines alloca, sometimes. */ -# ifndef alloca - -/* Make alloca work the best possible way. */ -# ifdef __GNUC__ -# define alloca __builtin_alloca -# else /* not __GNUC__ */ -# ifdef HAVE_ALLOCA_H -# include -# endif /* HAVE_ALLOCA_H */ -# endif /* not __GNUC__ */ - -# endif /* not alloca */ - # ifdef emacs # define REGEX_USE_SAFE_ALLOCA USE_SAFE_ALLOCA # define REGEX_SAFE_FREE() SAFE_FREE () # define REGEX_ALLOCATE SAFE_ALLOCA # else +# include # define REGEX_ALLOCATE alloca # endif =20 diff --git a/src/sysdep.c b/src/sysdep.c index 190d6fbe..0121f01 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ #include #endif /* HAVE_PWD_H */ #include +#include #include =20 #include diff --git a/src/systty.h b/src/systty.h index fbdc6b1..a53c874 100644 --- a/src/systty.h +++ b/src/systty.h @@ -26,7 +26,6 @@ along with GNU Emacs. If not, see . */ #include #endif /* not DOS_NT */ =20 -#include #include =20 #ifdef HPUX diff --git a/src/term.c b/src/term.c index c22d07a..d691a7a 100644 --- a/src/term.c +++ b/src/term.c @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include #include diff --git a/src/unexcw.c b/src/unexcw.c index 6343b38..c0d1bc1 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include "unexec.h" #include "lisp.h" -#include #include #include #include diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 185a9d1..ea8e884 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -85,20 +85,16 @@ along with GNU Emacs. If not, see . */ be changed accordingly. */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 - -/* config.h #define:s malloc/realloc/free and then includes stdlib.h. - We want the undefined versions, but if config.h includes stdlib.h - with the #define:s in place, the prototypes will be wrong and we get - warnings. To prevent that, include stdlib.h before config.h. */ - -#include #include + +/* Although redefines malloc to unexec_malloc, etc., this + file wants stdlib.h to declare the originals. */ #undef malloc #undef realloc #undef free =20 +#include + #include "unexec.h" #include "lisp.h" =20 diff --git a/src/w32.c b/src/w32.c index 6cb8e74..e0a3406 100644 --- a/src/w32.c +++ b/src/w32.c @@ -21,8 +21,8 @@ along with GNU Emacs. If not, see . */ Geoff Voelker (voelker@cs.washington.edu) 7-2= 9-94 */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include /* for offsetof */ @@ -40,9 +40,9 @@ along with GNU Emacs. If not, see . */ #include #include =20 -/* must include CRT headers *before* config.h */ +/* Include CRT headers *before* ms-w32.h. */ +#include =20 -#include #include /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ =20 #undef access diff --git a/src/w32notify.c b/src/w32notify.c index 15e8a86..32a03f7 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -81,14 +81,14 @@ along with GNU Emacs. If not, see . */ thread to exit. The main thread waits for some time for the worker thread to exit, and if it doesn't, terminates it forcibly. */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include =20 -/* must include CRT headers *before* config.h */ -#include +/* Include CRT headers *before* ms-w32.h. */ +#include =20 #include =20 diff --git a/src/w32proc.c b/src/w32proc.c index e23b1b3..aef4e44 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -22,8 +22,8 @@ along with GNU Emacs. If not, see . */ Adapted from alarm.c by Tim Fleehart */ =20 -/* Enable GNU extensions in gnulib replacement headers. */ -#define _GNU_SOURCE 1 +#define DEFER_MS_W32_H +#include =20 #include #include @@ -38,8 +38,8 @@ along with GNU Emacs. If not, see . */ #include #include =20 -/* must include CRT headers *before* config.h */ -#include +/* Include CRT headers *before* ms-w32.h. */ +#include =20 #undef signal #undef wait diff --git a/src/widget.c b/src/widget.c index 28bb475..59ed431 100644 --- a/src/widget.c +++ b/src/widget.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ #include "widget.h" =20 #include +#include =20 #include "lisp.h" #include "xterm.h" diff --git a/src/xdisp.c b/src/xdisp.c index 4bf1470..67d14c8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -288,6 +288,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include "lisp.h" diff --git a/src/xfaces.c b/src/xfaces.c index 056f90c..5837f35 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -200,6 +200,7 @@ along with GNU Emacs. If not, see . */ used to fill in unspecified attributes of the default face. */ =20 #include +#include #include "sysstdio.h" #include #include diff --git a/src/xfns.c b/src/xfns.c index dd39e78..8571d0e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include #include =20 diff --git a/src/xfont.c b/src/xfont.c index 8fbe94c..45b0e0a 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #include =20 #include "lisp.h" diff --git a/src/xgselect.c b/src/xgselect.c index ac88afd..7850a16 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see . */ =20 #include #include -#include #include "blockinput.h" #include "systime.h" =20 diff --git a/src/xterm.c b/src/xterm.c index 4c14e62..7476694 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ =20 #include #include +#include #ifdef USE_CAIRO #include #endif --=20 2.7.4 ------------=_1475264642-7386-1--