gbranden pushed a commit to branch master
in repository groff.

commit dd6b4aada262b8bb858001905531e8be16e5bcad
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Fri Dec 8 14:25:13 2023 -0600

    Manage config.h more consistently.
    
    * src/roff/troff/env.cpp: Ensure that we include config.h (if necessary)
      _before_ C standard library header math.h.
    
    * src/devices/xditview/Dvi.c:
    * src/devices/xditview/draw.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/geometry.cpp:
    * src/libs/libgroff/getcwd.c:
    * src/libs/libgroff/localcharset.c:
    * src/libs/libgroff/prime.cpp:
    * src/libs/libgroff/ptable.cpp:
    * src/libs/libgroff/quotearg.c:
    * src/libs/libgroff/spawnvp.c:
    * src/libs/libxutil/DviChar.c:
    * src/libs/libxutil/XFontName.c:
    * src/libs/libxutil/xmalloc.c:
    * src/preproc/eqn/eqn.ypp:
    * src/preproc/grn/hdb.cpp:
    * src/preproc/grn/hpoint.cpp:
    * src/roff/troff/env.cpp:
    * src/utils/indxbib/signal.c: Bracket inclusion of config.h with
      preprocessor test of `HAVE_CONFIG_H` where absent.  Use angle bracket
      rather than double-quote notation for the preprocessor file inclusion.
      See <https://savannah.gnu.org/bugs/?60035>.
---
 ChangeLog                        | 38 ++++++++++++++++++++++++++++++++++++++
 src/devices/xditview/Dvi.c       |  2 ++
 src/devices/xditview/draw.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            |  2 ++
 src/libs/libgroff/change_lf.cpp  |  3 +++
 src/libs/libgroff/cmap.cpp       |  3 +++
 src/libs/libgroff/cset.cpp       |  3 +++
 src/libs/libgroff/fmod.c         |  3 +++
 src/libs/libgroff/geometry.cpp   |  2 +-
 src/libs/libgroff/getcwd.c       |  3 +++
 src/libs/libgroff/localcharset.c |  2 ++
 src/libs/libgroff/prime.cpp      |  2 +-
 src/libs/libgroff/ptable.cpp     |  2 ++
 src/libs/libgroff/quotearg.c     |  2 ++
 src/libs/libgroff/spawnvp.c      |  2 +-
 src/libs/libxutil/DviChar.c      |  2 ++
 src/libs/libxutil/XFontName.c    |  2 ++
 src/libs/libxutil/xmalloc.c      |  2 ++
 src/preproc/eqn/eqn.ypp          |  2 +-
 src/preproc/grn/hdb.cpp          |  2 +-
 src/preproc/grn/hpoint.cpp       |  2 +-
 src/roff/troff/env.cpp           |  7 ++++++-
 src/utils/indxbib/signal.c       |  2 ++
 27 files changed, 92 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7396c7345..4638fee8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2023-12-08  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       Manage config.h more consistently.
+
+       * src/roff/troff/env.cpp: Ensure that we include config.h (if
+       necessary) _before_ C standard library header math.h.
+
+       * src/devices/xditview/Dvi.c:
+       * src/devices/xditview/draw.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/geometry.cpp:
+       * src/libs/libgroff/getcwd.c:
+       * src/libs/libgroff/localcharset.c:
+       * src/libs/libgroff/prime.cpp:
+       * src/libs/libgroff/ptable.cpp:
+       * src/libs/libgroff/quotearg.c:
+       * src/libs/libgroff/spawnvp.c:
+       * src/libs/libxutil/DviChar.c:
+       * src/libs/libxutil/XFontName.c:
+       * src/libs/libxutil/xmalloc.c:
+       * src/preproc/eqn/eqn.ypp:
+       * src/preproc/grn/hdb.cpp:
+       * src/preproc/grn/hpoint.cpp:
+       * src/roff/troff/env.cpp:
+       * src/utils/indxbib/signal.c: Bracket inclusion of config.h with
+       preprocessor test of `HAVE_CONFIG_H` where absent.  Use
+       angle bracket rather than double-quote notation for the
+       preprocessor file inclusion.  See
+       <https://savannah.gnu.org/bugs/?60035>.
+
 2023-12-07  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/env.cpp (do_hyphenation_patterns_file):
diff --git a/src/devices/xditview/Dvi.c b/src/devices/xditview/Dvi.c
index bc62386cd..26f0ee6bf 100644
--- a/src/devices/xditview/Dvi.c
+++ b/src/devices/xditview/Dvi.c
@@ -1,4 +1,6 @@
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #ifndef SABER
 #ifndef lint
diff --git a/src/devices/xditview/draw.c b/src/devices/xditview/draw.c
index 288d98abc..d1fb148f7 100644
--- a/src/devices/xditview/draw.c
+++ b/src/devices/xditview/draw.c
@@ -4,7 +4,7 @@
  * accept dvi function calls and translate to X
  */
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <X11/Xos.h>
diff --git a/src/devices/xditview/font.c b/src/devices/xditview/font.c
index 846260820..419de4bf3 100644
--- a/src/devices/xditview/font.c
+++ b/src/devices/xditview/font.c
@@ -4,7 +4,9 @@
  * map dvi fonts to X fonts
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
diff --git a/src/devices/xditview/lex.c b/src/devices/xditview/lex.c
index 19cf29204..9637210fa 100644
--- a/src/devices/xditview/lex.c
+++ b/src/devices/xditview/lex.c
@@ -1,4 +1,6 @@
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
diff --git a/src/devices/xditview/page.c b/src/devices/xditview/page.c
index 352d87126..a877a8470 100644
--- a/src/devices/xditview/page.c
+++ b/src/devices/xditview/page.c
@@ -4,7 +4,9 @@
  * map page numbers to file position
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
diff --git a/src/devices/xditview/parse.c b/src/devices/xditview/parse.c
index 456c7dabf..2c6b48e69 100644
--- a/src/devices/xditview/parse.c
+++ b/src/devices/xditview/parse.c
@@ -4,7 +4,9 @@
  * parse dvi input
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xos.h>
 #include <X11/IntrinsicP.h>
diff --git a/src/libs/libbib/map.c b/src/libs/libbib/map.c
index 9eae72b80..7da0f6e57 100644
--- a/src/libs/libbib/map.c
+++ b/src/libs/libbib/map.c
@@ -16,7 +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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdlib.h>
 
diff --git a/src/libs/libgroff/change_lf.cpp b/src/libs/libgroff/change_lf.cpp
index eb98766db..012ac8486 100644
--- a/src/libs/libgroff/change_lf.cpp
+++ b/src/libs/libgroff/change_lf.cpp
@@ -16,7 +16,10 @@ 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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <string.h>
 
 extern char *strsave(const char *);
diff --git a/src/libs/libgroff/cmap.cpp b/src/libs/libgroff/cmap.cpp
index 3f2c0c321..cc685f35b 100644
--- a/src/libs/libgroff/cmap.cpp
+++ b/src/libs/libgroff/cmap.cpp
@@ -17,7 +17,10 @@ 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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <ctype.h>
 #include "cmap.h"
 
diff --git a/src/libs/libgroff/cset.cpp b/src/libs/libgroff/cset.cpp
index 67022372f..9f080fbac 100644
--- a/src/libs/libgroff/cset.cpp
+++ b/src/libs/libgroff/cset.cpp
@@ -17,7 +17,10 @@ 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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <ctype.h>
 
 #include "lib.h"
diff --git a/src/libs/libgroff/fmod.c b/src/libs/libgroff/fmod.c
index 45278f963..121ebec39 100644
--- a/src/libs/libgroff/fmod.c
+++ b/src/libs/libgroff/fmod.c
@@ -16,7 +16,10 @@ 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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <math.h>
 
 double fmod(x, y)
diff --git a/src/libs/libgroff/geometry.cpp b/src/libs/libgroff/geometry.cpp
index c4665c40e..971c86175 100644
--- a/src/libs/libgroff/geometry.cpp
+++ b/src/libs/libgroff/geometry.cpp
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public 
License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <stdio.h>
diff --git a/src/libs/libgroff/getcwd.c b/src/libs/libgroff/getcwd.c
index dd8b57888..a95da6062 100644
--- a/src/libs/libgroff/getcwd.c
+++ b/src/libs/libgroff/getcwd.c
@@ -18,7 +18,10 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 /* Partial emulation of getcwd in terms of getwd. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <sys/param.h>
 #include <string.h>
 #include <errno.h>
diff --git a/src/libs/libgroff/localcharset.c b/src/libs/libgroff/localcharset.c
index 1bc07a489..9ce57a835 100644
--- a/src/libs/libgroff/localcharset.c
+++ b/src/libs/libgroff/localcharset.c
@@ -17,7 +17,9 @@
 
 /* Written by Bruno Haible <br...@clisp.org>.  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 /* Specification.  */
 #include "localcharset.h"
diff --git a/src/libs/libgroff/prime.cpp b/src/libs/libgroff/prime.cpp
index 5ae068df4..b1e73470a 100644
--- a/src/libs/libgroff/prime.cpp
+++ b/src/libs/libgroff/prime.cpp
@@ -16,7 +16,7 @@ The GNU General Public License version 2 (GPL2) is available 
in the
 internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <assert.h>
diff --git a/src/libs/libgroff/ptable.cpp b/src/libs/libgroff/ptable.cpp
index 52d09f8b1..1289f85d9 100644
--- a/src/libs/libgroff/ptable.cpp
+++ b/src/libs/libgroff/ptable.cpp
@@ -16,7 +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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include "ptable.h"
 #include "errarg.h"
diff --git a/src/libs/libgroff/quotearg.c b/src/libs/libgroff/quotearg.c
index 6d2126bd3..950cc98dc 100644
--- a/src/libs/libgroff/quotearg.c
+++ b/src/libs/libgroff/quotearg.c
@@ -17,7 +17,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/>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/libs/libgroff/spawnvp.c b/src/libs/libgroff/spawnvp.c
index 1fffa2b89..765e7588f 100644
--- a/src/libs/libgroff/spawnvp.c
+++ b/src/libs/libgroff/spawnvp.c
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public 
License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #ifdef HAVE_CONFIG_H
-# include "config.h"
+# include <config.h>
 #endif
 
 #include <stdio.h>
diff --git a/src/libs/libxutil/DviChar.c b/src/libs/libxutil/DviChar.c
index fe086fc09..6e8e9c5ee 100644
--- a/src/libs/libxutil/DviChar.c
+++ b/src/libs/libxutil/DviChar.c
@@ -22,7 +22,9 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
  * font indexes and back
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/libs/libxutil/XFontName.c b/src/libs/libxutil/XFontName.c
index fd31b6f14..fa9334778 100644
--- a/src/libs/libxutil/XFontName.c
+++ b/src/libs/libxutil/XFontName.c
@@ -21,7 +21,9 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
  * build/parse X Font name strings
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xlib.h>
 #include <X11/Xos.h>
diff --git a/src/libs/libxutil/xmalloc.c b/src/libs/libxutil/xmalloc.c
index 0852c626a..7c19c2ef9 100644
--- a/src/libs/libxutil/xmalloc.c
+++ b/src/libs/libxutil/xmalloc.c
@@ -15,7 +15,9 @@ 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>. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <X11/Xlib.h>
 #include <X11/Intrinsic.h>
diff --git a/src/preproc/eqn/eqn.ypp b/src/preproc/eqn/eqn.ypp
index 63828fa33..c879ea5bd 100644
--- a/src/preproc/eqn/eqn.ypp
+++ b/src/preproc/eqn/eqn.ypp
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public 
License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 %{
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <stdio.h>
diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
index 9ba3eaa80..f253874f6 100644
--- a/src/preproc/grn/hdb.cpp
+++ b/src/preproc/grn/hdb.cpp
@@ -7,7 +7,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <stdlib.h>
diff --git a/src/preproc/grn/hpoint.cpp b/src/preproc/grn/hpoint.cpp
index 5ef0c0a2b..8c4e5d4b4 100644
--- a/src/preproc/grn/hpoint.cpp
+++ b/src/preproc/grn/hpoint.cpp
@@ -6,7 +6,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <stdlib.h>
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index eb1583475..942332d5d 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -31,7 +31,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "charinfo.h"
 #include "macropath.h"
 #include "input.h"
-#include <math.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <math.h> // ceil()
 
 symbol default_family("T");
 
diff --git a/src/utils/indxbib/signal.c b/src/utils/indxbib/signal.c
index 2231b646a..7cf0dea9b 100644
--- a/src/utils/indxbib/signal.c
+++ b/src/utils/indxbib/signal.c
@@ -19,7 +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. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <sys/types.h>

_______________________________________________
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to