groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 09/09: Include <config.h> before any standard headers.


From: G. Branden Robinson
Subject: [groff] 09/09: Include <config.h> before any standard headers.
Date: Sun, 10 Oct 2021 16:50:08 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 0c7866632d0490ac452de609c3c4d624a170c8a6
Author: Paul Eggert <eggert@cs.ucla.edu>
AuthorDate: Sat Oct 9 00:38:54 2021 -0700

    Include <config.h> before any standard headers.
    
    Gnulib requires that files that might use Gnulib features (which pretty
    much means every C or C++ source file) must include <config.h> first.
    Arrange for that.  This will be needed once Groff updates to the latest
    Gnulib; see Bjarni Ingi Gislason's problem report in:
    https://lists.gnu.org/r/bug-gnulib/2021-10/msg00008.html
    
    The only exception I can see is src/utils/addftinfo/guess.cpp, which
    does not include any standard include file either directly or
    indirectly, and so need not include <config.h>.
    
    * src/devices/xditview/Dvi.c:
    * src/devices/xditview/font.c:
    * src/devices/xditview/lex.c:
    * src/devices/xditview/page.c:
    * src/devices/xditview/parse.c:
    * src/libs/libbib/map.c:
    * src/libs/libgroff/change_lf.cpp:
    * src/libs/libgroff/cmap.cpp:
    * src/libs/libgroff/cset.cpp:
    * src/libs/libgroff/fmod.c:
    * src/libs/libgroff/getcwd.c:
    * src/libs/libgroff/lf.cpp:
    * src/libs/libgroff/ptable.cpp:
    * src/libs/libgroff/quotearg.c:
    * src/libs/libxutil/DviChar.c:
    * src/libs/libxutil/XFontName.c:
    * src/libs/libxutil/xmalloc.c:
    * src/utils/indxbib/signal.c: Do it.
    
    [Fixes <https://savannah.gnu.org/bugs/?61315>. --GBR]
---
 ChangeLog                       | 36 ++++++++++++++++++++++++++++++++++++
 src/devices/xditview/Dvi.c      |  2 ++
 src/devices/xditview/font.c     |  2 ++
 src/devices/xditview/lex.c      |  2 ++
 src/devices/xditview/page.c     |  2 ++
 src/devices/xditview/parse.c    |  2 ++
 src/libs/libbib/map.c           |  6 ++----
 src/libs/libgroff/change_lf.cpp |  1 +
 src/libs/libgroff/cmap.cpp      |  1 +
 src/libs/libgroff/cset.cpp      |  1 +
 src/libs/libgroff/fmod.c        |  2 +-
 src/libs/libgroff/getcwd.c      |  1 +
 src/libs/libgroff/lf.cpp        |  4 ++--
 src/libs/libgroff/ptable.cpp    |  2 ++
 src/libs/libgroff/quotearg.c    |  2 ++
 src/libs/libxutil/DviChar.c     |  2 ++
 src/libs/libxutil/XFontName.c   |  2 ++
 src/libs/libxutil/xmalloc.c     |  2 ++
 src/utils/indxbib/signal.c      |  5 +----
 19 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 338d58a..a5dbabf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2021-10-11  Paul Eggert <eggert@cs.ucla.edu>
+
+       Include <config.h> before any standard headers.
+
+       Gnulib requires that files that might use Gnulib features (which
+       pretty much means every C or C++ source file) must include
+       <config.h> first.  Arrange for that.  This will be needed once
+       Groff updates to the latest Gnulib; see Bjarni Ingi Gislason's
+       problem report in:
+       <https://lists.gnu.org/r/bug-gnulib/2021-10/msg00008.html>
+
+       The only exception I can see is src/utils/addftinfo/guess.cpp,
+       which does not include any standard include file either directly
+       or indirectly, and so need not include <config.h>.
+
+       * src/devices/xditview/Dvi.c:
+       * src/devices/xditview/font.c:
+       * src/devices/xditview/lex.c:
+       * src/devices/xditview/page.c:
+       * src/devices/xditview/parse.c:
+       * src/libs/libbib/map.c:
+       * src/libs/libgroff/change_lf.cpp:
+       * src/libs/libgroff/cmap.cpp:
+       * src/libs/libgroff/cset.cpp:
+       * src/libs/libgroff/fmod.c:
+       * src/libs/libgroff/getcwd.c:
+       * src/libs/libgroff/lf.cpp:
+       * src/libs/libgroff/ptable.cpp:
+       * src/libs/libgroff/quotearg.c:
+       * src/libs/libxutil/DviChar.c:
+       * src/libs/libxutil/XFontName.c:
+       * src/libs/libxutil/xmalloc.c:
+       * src/utils/indxbib/signal.c: Do it.
+
+       [Fixes <https://savannah.gnu.org/bugs/?61315>. --GBR]
+
 2021-10-10  Deri James  <deri@chuzzlewit.myzen.co.uk>
 
        Handle pdfs > v1.4 loaded by \X'pdf: pdfpic.
diff --git a/src/devices/xditview/Dvi.c b/src/devices/xditview/Dvi.c
index 28512ae..3520676 100644
--- a/src/devices/xditview/Dvi.c
+++ b/src/devices/xditview/Dvi.c
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifndef SABER
 #ifndef lint
 static char Xrcsid[] = "$XConsortium: Dvi.c,v 1.9 89/12/10 16:12:25 rws Exp $";
diff --git a/src/devices/xditview/font.c b/src/devices/xditview/font.c
index 97eb46e..8462608 100644
--- a/src/devices/xditview/font.c
+++ b/src/devices/xditview/font.c
@@ -4,6 +4,8 @@
  * map dvi fonts to X fonts
  */
 
+#include <config.h>
+
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
 #include <X11/StringDefs.h>
diff --git a/src/devices/xditview/lex.c b/src/devices/xditview/lex.c
index 7571101..19cf292 100644
--- a/src/devices/xditview/lex.c
+++ b/src/devices/xditview/lex.c
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
 #include <X11/StringDefs.h>
diff --git a/src/devices/xditview/page.c b/src/devices/xditview/page.c
index dcc655a..352d871 100644
--- a/src/devices/xditview/page.c
+++ b/src/devices/xditview/page.c
@@ -4,6 +4,8 @@
  * map page numbers to file position
  */
 
+#include <config.h>
+
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
 #include <X11/StringDefs.h>
diff --git a/src/devices/xditview/parse.c b/src/devices/xditview/parse.c
index 2584a8c..456c7da 100644
--- a/src/devices/xditview/parse.c
+++ b/src/devices/xditview/parse.c
@@ -4,6 +4,8 @@
  * parse dvi input
  */
 
+#include <config.h>
+
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
 #include <X11/StringDefs.h>
diff --git a/src/libs/libbib/map.c b/src/libs/libbib/map.c
index 5710d31..9eae72b 100644
--- a/src/libs/libbib/map.c
+++ b/src/libs/libbib/map.c
@@ -16,11 +16,9 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
+
+#include <stdlib.h>
 
 #ifdef HAVE_MMAP
 
diff --git a/src/libs/libgroff/change_lf.cpp b/src/libs/libgroff/change_lf.cpp
index 5a18375..eb98766 100644
--- a/src/libs/libgroff/change_lf.cpp
+++ b/src/libs/libgroff/change_lf.cpp
@@ -16,6 +16,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
 #include <string.h>
 
 extern char *strsave(const char *);
diff --git a/src/libs/libgroff/cmap.cpp b/src/libs/libgroff/cmap.cpp
index 4a80a6d..3f2c0c3 100644
--- a/src/libs/libgroff/cmap.cpp
+++ b/src/libs/libgroff/cmap.cpp
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
 #include <ctype.h>
 #include "cmap.h"
 
diff --git a/src/libs/libgroff/cset.cpp b/src/libs/libgroff/cset.cpp
index 9790550..6702237 100644
--- a/src/libs/libgroff/cset.cpp
+++ b/src/libs/libgroff/cset.cpp
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
 #include <ctype.h>
 
 #include "lib.h"
diff --git a/src/libs/libgroff/fmod.c b/src/libs/libgroff/fmod.c
index 8b0b25a..45278f9 100644
--- a/src/libs/libgroff/fmod.c
+++ b/src/libs/libgroff/fmod.c
@@ -16,6 +16,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
 #include <math.h>
 
 double fmod(x, y)
@@ -24,4 +25,3 @@ double fmod(x, y)
   double quot = x/y;
   return x - (quot < 0.0 ? ceil(quot) : floor(quot)) * y;
 }
-
diff --git a/src/libs/libgroff/getcwd.c b/src/libs/libgroff/getcwd.c
index d0cfc8f..dd8b578 100644
--- a/src/libs/libgroff/getcwd.c
+++ b/src/libs/libgroff/getcwd.c
@@ -18,6 +18,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 /* Partial emulation of getcwd in terms of getwd. */
 
+#include <config.h>
 #include <sys/param.h>
 #include <string.h>
 #include <errno.h>
diff --git a/src/libs/libgroff/lf.cpp b/src/libs/libgroff/lf.cpp
index 135fd79..9c255fb 100644
--- a/src/libs/libgroff/lf.cpp
+++ b/src/libs/libgroff/lf.cpp
@@ -17,13 +17,13 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#include <ctype.h>
-
 #include "lib.h"
 #include "cset.h"
 #include "stringclass.h"
 #include "lf.h"
 
+#include <ctype.h>
+
 extern void change_filename(const char *);
 extern void change_lineno(int);
 
diff --git a/src/libs/libgroff/ptable.cpp b/src/libs/libgroff/ptable.cpp
index eff0e04..52d09f8 100644
--- a/src/libs/libgroff/ptable.cpp
+++ b/src/libs/libgroff/ptable.cpp
@@ -16,6 +16,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
+
 #include "ptable.h"
 #include "errarg.h"
 #include "error.h"
diff --git a/src/libs/libgroff/quotearg.c b/src/libs/libgroff/quotearg.c
index 8d21707..75eaca8 100644
--- a/src/libs/libgroff/quotearg.c
+++ b/src/libs/libgroff/quotearg.c
@@ -17,6 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/libs/libxutil/DviChar.c b/src/libs/libxutil/DviChar.c
index ef9262d..d44e27c 100644
--- a/src/libs/libxutil/DviChar.c
+++ b/src/libs/libxutil/DviChar.c
@@ -22,6 +22,8 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
  * font indexes and back
  */
 
+#include <config.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include "DviChar.h"
diff --git a/src/libs/libxutil/XFontName.c b/src/libs/libxutil/XFontName.c
index d366ada..81ccdaa 100644
--- a/src/libs/libxutil/XFontName.c
+++ b/src/libs/libxutil/XFontName.c
@@ -21,6 +21,8 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
  * build/parse X Font name strings
  */
 
+#include <config.h>
+
 #include <X11/Xlib.h>
 #include <X11/Xos.h>
 #include "XFontName.h"
diff --git a/src/libs/libxutil/xmalloc.c b/src/libs/libxutil/xmalloc.c
index 9eb7564..0852c62 100644
--- a/src/libs/libxutil/xmalloc.c
+++ b/src/libs/libxutil/xmalloc.c
@@ -15,6 +15,8 @@ for more details.
 The GNU General Public License version 2 (GPL2) is available in the
 internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
 
+#include <config.h>
+
 #include <X11/Xlib.h>
 #include <X11/Intrinsic.h>
 
diff --git a/src/utils/indxbib/signal.c b/src/utils/indxbib/signal.c
index a1f30ce..2231b64 100644
--- a/src/utils/indxbib/signal.c
+++ b/src/utils/indxbib/signal.c
@@ -19,12 +19,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 /* Unfortunately vendors seem to have problems writing a <signal.h>
 that is correct for C++, so we implement all signal handling in C. */
 
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
+#include <stdlib.h>
 #include <sys/types.h>
 #include <signal.h>
 #ifdef HAVE_UNISTD_H



reply via email to

[Prev in Thread] Current Thread [Next in Thread]