gbranden pushed a commit to branch master
in repository groff.

commit fbdd5a0a61b92540816110950101b3ece24bf3ae
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun May 31 08:33:34 2026 -0500

    [pic]: Fix code style nit. (2/2)
    
    * src/preproc/pic/lex.cpp (process_body)
      (interpolate_macro_with_args, lookup_keyword)
      (get_token_after_dot, get_token, get_delimited, do_define)
      (do_undef, get_thru_arg):
    * src/preproc/pic/main.cpp (do_picture, usage):
    * src/preproc/pic/object.cpp (draw_arrow):
    * src/preproc/pic/troff.cpp (strsame): Define functions as `static`;
      external linkage is not required.
    
    Fixes `-Wmissing-declarations` GCC warning.
---
 ChangeLog                  | 15 +++++++++++++++
 src/preproc/pic/lex.cpp    | 18 +++++++++---------
 src/preproc/pic/main.cpp   |  4 ++--
 src/preproc/pic/object.cpp |  6 +++---
 src/preproc/pic/troff.cpp  |  3 ++-
 5 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 215fbf38d..287e06918 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-05-31  G. Branden Robinson <[email protected]>
+
+       [pic]: Fix code style nit.
+
+       * src/preproc/pic/lex.cpp (process_body)
+       (interpolate_macro_with_args, lookup_keyword)
+       (get_token_after_dot, get_token, get_delimited, do_define)
+       (do_undef, get_thru_arg):
+       * src/preproc/pic/main.cpp (do_picture, usage):
+       * src/preproc/pic/object.cpp (draw_arrow):
+       * src/preproc/pic/troff.cpp (strsame): Define functions as
+       `static`; external linkage is not required.
+
+       Fixes `-Wmissing-declarations` GCC warning.
+
 2026-05-31  G. Branden Robinson <[email protected]>
 
        * src/preproc/pic/lex.cpp: Fix code style nit.  Add `extern`
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index f98888fb9..0b97ed7de 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -173,7 +173,7 @@ int macro_input::peek()
     return (unsigned char)*p;
 }
 
-char *process_body(const char *body)
+static char *process_body(const char *body)
 {
   char *s = strsave(body);
   int j = 0;
@@ -388,7 +388,7 @@ string token_buffer;
 double token_double;
 int token_int;
 
-void interpolate_macro_with_args(const char *body)
+static void interpolate_macro_with_args(const char *body)
 {
   char *argv[MAX_ARG];
   int argc = 0;
@@ -464,7 +464,7 @@ static int docmp(const char *s1, int n1, const char *s2, 
int n2)
     return memcmp(s1, s2, n1);
 }
 
-int lookup_keyword(const char *str, int len)
+static int lookup_keyword(const char *str, int len)
 {
   static struct keyword {
     const char *name;
@@ -588,7 +588,7 @@ int lookup_keyword(const char *str, int len)
   return 0;
 }
 
-int get_token_after_dot(int c)
+static int get_token_after_dot(int c)
 {
   // get_token deals with the case where c is a digit
   switch (c) {
@@ -934,7 +934,7 @@ int get_token_after_dot(int c)
   }
 }
 
-int get_token(int lookup_flag)
+static int get_token(int lookup_flag)
 {
   context_buffer.clear();
   for (;;) {
@@ -1333,7 +1333,7 @@ int get_token(int lookup_flag)
   }
 }
 
-int get_delimited()
+static int get_delimited()
 {
   token_buffer.clear();
   int c = input_stack::get_char();
@@ -1402,7 +1402,7 @@ int get_delimited()
   return 1;
 }
 
-void do_define()
+static void do_define()
 {
   int t = get_token(0);                // do not expand what we are defining
   if (t != VARIABLE && t != LABEL) {
@@ -1418,7 +1418,7 @@ void do_define()
   macro_table.define(name, strsave(token_buffer.contents()));
 }
 
-void do_undef()
+static void do_undef()
 {
   int t = get_token(0);                // do not expand what we are undefining
   if (t != VARIABLE && t != LABEL) {
@@ -1800,7 +1800,7 @@ void push_body(const char *s)
 
 int delim_flag = 0;
 
-char *get_thru_arg()
+static char *get_thru_arg()
 {
   int c = input_stack::peek_char();
   while (c == ' ') {
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 7bfb6d804..b1b5ca66c 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -224,7 +224,7 @@ int top_input::get_location(const char **filenamep, int 
*linenop)
   return 1;
 }
 
-void do_picture(FILE *fp)
+static void do_picture(FILE *fp)
 {
   want_flyback = false;
   int c;
@@ -482,7 +482,7 @@ void do_whole_file(const char *filename)
 }
 #endif
 
-void usage(FILE *stream)
+static void usage(FILE *stream)
 {
   fprintf(stream, "usage: %s [-CnSU] [file ...]\n", program_name);
 #ifdef TEX_SUPPORT
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index d33951104..f2edf200c 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -216,9 +216,9 @@ struct arrow_head_type {
   int solid;
 };
 
-void draw_arrow(const position &pos, const distance &dir,
-               const arrow_head_type &aht, const line_type &lt,
-               char *outline_color_for_fill)
+static void draw_arrow(const position &pos, const distance &dir,
+                      const arrow_head_type &aht, const line_type &lt,
+                      char *outline_color_for_fill)
 {
   double hyp = hypot(dir);
   if (hyp == 0.0) {
diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp
index 478a83cc0..dc0cdc1a0 100644
--- a/src/preproc/pic/troff.cpp
+++ b/src/preproc/pic/troff.cpp
@@ -589,7 +589,8 @@ void troff_output::dot(const position &cent, const 
line_type &lt)
 
 // We might consider putting this in libgroff.  We treat null pointers
 // like NaNs: they are incommensurable even with themselves.
-bool strsame(const char *s, const char *t)
+// TODO: Migrate to C2y's streq().
+static bool strsame(const char *s, const char *t)
 {
   if ((s == 0 /* nullptr */) || (t == 0 /* nullptr */))
     return false;

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

Reply via email to