gbranden pushed a commit to branch master
in repository groff.

commit 2f7958fc973ee10edd1708cf0169d75211ffa519
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun May 31 06:22:57 2026 -0500

    [grn]: Give command a proper header file.
    
    ...for external symbols.
    
    * src/preproc/grn/hdb.cpp:
    * src/preproc/grn/hpoint.cpp:
    * src/preproc/grn/main.cpp: Move `extern` declarations of symbols from
      here...
    * src/preproc/grn/grn.h: ...to this new file.
    
    * src/preproc/grn/hdb.cpp:
    * src/preproc/grn/hgraph.cpp:
    * src/preproc/grn/hpoint.cpp:
    * src/preproc/grn/main.cpp: Preprocessor-include new file.
    
    * src/preproc/grn/grn.am: Add new file to `grn_SOURCES` macro
      definition.
    
    Fixes `-Wmissing-declarations` GCC warning.
---
 ChangeLog                  | 16 ++++++++++++++++
 src/preproc/grn/grn.am     |  5 +++--
 src/preproc/grn/grn.h      | 14 ++++++++++++++
 src/preproc/grn/hdb.cpp    | 10 ++--------
 src/preproc/grn/hgraph.cpp |  1 +
 src/preproc/grn/hpoint.cpp |  4 +---
 src/preproc/grn/main.cpp   |  7 +------
 7 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 14551b6b8..82c4df73f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2026-05-31  G. Branden Robinson <[email protected]>
+
+       [grn]: Give command a proper header file for external symbols.
+
+       * src/preproc/grn/hdb.cpp:
+       * src/preproc/grn/hpoint.cpp:
+       * src/preproc/grn/main.cpp: Move `extern` declarations of
+       symbols from here...
+       * src/preproc/grn/grn.h: ...to this new file.
+       * src/preproc/grn/hdb.cpp:
+       * src/preproc/grn/hgraph.cpp:
+       * src/preproc/grn/hpoint.cpp:
+       * src/preproc/grn/main.cpp: Preprocessor-include new file.
+       * src/preproc/grn/grn.am: Add new file to `grn_SOURCES` macro
+       definition.
+
 2026-05-31  G. Branden Robinson <[email protected]>
 
        * src/preproc/grn/main.cpp: Rationalize header file inclusions.
diff --git a/src/preproc/grn/grn.am b/src/preproc/grn/grn.am
index 6b6dce65f..6aef13a49 100644
--- a/src/preproc/grn/grn.am
+++ b/src/preproc/grn/grn.am
@@ -17,11 +17,12 @@
 
 prefixexecbin_PROGRAMS += grn
 grn_SOURCES = \
+  src/preproc/grn/gprint.h \
+  src/preproc/grn/grn.h \
   src/preproc/grn/hdb.cpp \
   src/preproc/grn/hpoint.cpp \
   src/preproc/grn/hgraph.cpp \
-  src/preproc/grn/main.cpp \
-  src/preproc/grn/gprint.h
+  src/preproc/grn/main.cpp
 src/preproc/grn/main.$(OBJEXT): defs.h
 grn_LDADD = libgroff.a lib/libgnu.a $(LIBM)
 PREFIXMAN1 += src/preproc/grn/grn.1
diff --git a/src/preproc/grn/grn.h b/src/preproc/grn/grn.h
new file mode 100644
index 000000000..53404b7c7
--- /dev/null
+++ b/src/preproc/grn/grn.h
@@ -0,0 +1,14 @@
+// hdb.cpp
+extern ELT *DBInit();
+extern ELT *DBRead(FILE *);
+
+// hgraph.cpp
+extern void HGPrintElt(ELT *, int);
+
+// hpoint.cpp
+extern POINT *PTInit();
+extern POINT *PTMakePoint(double, double, POINT **);
+
+// main.cpp
+extern void *grnmalloc(size_t, const char *);
+extern void savebounds(double, double);
diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
index 44d7f5d95..a84b27fdf 100644
--- a/src/preproc/grn/hdb.cpp
+++ b/src/preproc/grn/hdb.cpp
@@ -21,7 +21,9 @@
 
 #include "errarg.h"
 #include "error.h"
+
 #include "gprint.h"
+#include "grn.h"
 
 #define MAXSTRING 128
 #define MAXSTRING_S "127"
@@ -31,14 +33,6 @@
 extern char gremlinfile[];     /* name of file currently reading */
 extern int SUNFILE;            /* TRUE if SUN gremlin file */
 extern int compatibility_flag; /* TRUE if in compatibility mode */
-extern void *grnmalloc(size_t size, const char *what);
-extern void savebounds(double x, double y);
-
-/* imports from hpoint.cpp */
-
-extern POINT *PTInit();
-extern POINT *PTMakePoint(double x, double y, POINT ** pplist);
-
 
 int DBGetType(char *s);
 
diff --git a/src/preproc/grn/hgraph.cpp b/src/preproc/grn/hgraph.cpp
index 4365e200f..5c60ae938 100644
--- a/src/preproc/grn/hgraph.cpp
+++ b/src/preproc/grn/hgraph.cpp
@@ -17,6 +17,7 @@
 #include "lib.h"
 
 #include "gprint.h"
+#include "grn.h"
 
 #define MAXVECT        40
 #define MAXPOINTS      200
diff --git a/src/preproc/grn/hpoint.cpp b/src/preproc/grn/hpoint.cpp
index 69613c32b..ef92e615e 100644
--- a/src/preproc/grn/hpoint.cpp
+++ b/src/preproc/grn/hpoint.cpp
@@ -15,9 +15,7 @@
 #endif
 
 #include "gprint.h"
-
-/* imports from main.cpp */
-extern void *grnmalloc(size_t size, const char *what);
+#include "grn.h"
 
 /*
  * Return pointer to empty point list.
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index 9f0605138..d6f50418d 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -98,17 +98,12 @@
 #include "macropath.h"
 
 #include "gprint.h"
+#include "grn.h"
 
 extern "C" const char *Version_string;
 
 /* database imports */
 
-extern void HGPrintElt(ELT *element, int baseline);
-extern ELT *DBInit();
-extern ELT *DBRead(FILE *file);
-extern POINT *PTInit();
-extern POINT *PTMakePoint(double x, double y, POINT **pplist);
-
 #define INIT_FILE_SIZE 50  /* Initial sz of file array from cmd line. */
 #define FILE_SIZE_INCR 50  /* Amount to increase array of files by. */
 

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to