gbranden pushed a commit to branch master
in repository groff.
commit 3c4cee7fb012e2a2edbd79317f99b87101b46b53
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jun 11 15:25:10 2026 -0500
[refer]: Declare file-local functions as `static`.
* src/preproc/refer/command.cpp (get_word):
* src/preproc/refer/ref.cpp (sortify_words)
(sortify_word)
(sortify_other)
(sortify_title)
(sortify_name)
(sortify_date)
(sortify_label)
(reverse_names)
(join_fields)
(capitalize_field)
(is_terminated):
* src/preproc/refer/refer.cpp (rcompare): Define function as `static`;
external linkage is not required.
Fixes `-Wmissing-declarations` GCC warning.
---
ChangeLog | 19 +++++++++++++++++++
src/preproc/refer/command.cpp | 2 +-
src/preproc/refer/ref.cpp | 25 +++++++++++++------------
src/preproc/refer/refer.cpp | 2 +-
4 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 98780470a..56cc7684b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2026-06-11 G. Branden Robinson <[email protected]>
+
+ * src/preproc/refer/command.cpp (get_word):
+ * src/preproc/refer/ref.cpp (sortify_words)
+ (sortify_word)
+ (sortify_other)
+ (sortify_title)
+ (sortify_name)
+ (sortify_date)
+ (sortify_label)
+ (reverse_names)
+ (join_fields)
+ (capitalize_field)
+ (is_terminated):
+ * src/preproc/refer/refer.cpp (rcompare): Define function as
+ `static`; external linkage is not required.
+
+ Fixes `-Wmissing-declarations` GCC warning.
+
2026-06-11 G. Branden Robinson <[email protected]>
* src/preproc/refer/command.cpp (input_item::input_item):
diff --git a/src/preproc/refer/command.cpp b/src/preproc/refer/command.cpp
index de7ac7516..c032a6b4a 100644
--- a/src/preproc/refer/command.cpp
+++ b/src/preproc/refer/command.cpp
@@ -258,7 +258,7 @@ void command_error(const char *format, const errarg &arg1,
// don't clear word_buffer; just append on
// return -1 for EOF, 0 for newline, 1 for word
-int get_word(string &word_buffer)
+static int get_word(string &word_buffer)
{
int c = input_stack::get_char();
for (;;) {
diff --git a/src/preproc/refer/ref.cpp b/src/preproc/refer/ref.cpp
index 95917c8ef..3789c8473 100644
--- a/src/preproc/refer/ref.cpp
+++ b/src/preproc/refer/ref.cpp
@@ -267,8 +267,8 @@ const char SORT_SUB_SUB_SEP = '\003';
// sep specifies additional word separators
-void sortify_words(const char *s, const char *end, const char *sep,
- string &result)
+static void sortify_words(const char *s, const char *end,
+ const char *sep, string &result)
{
int non_empty = 0;
int need_separator = 0;
@@ -300,7 +300,7 @@ void sortify_words(const char *s, const char *end, const
char *sep,
}
}
-void sortify_word(const char *s, const char *end, string &result)
+static void sortify_word(const char *s, const char *end, string &result)
{
for (;;) {
const char *token_start = s;
@@ -311,12 +311,12 @@ void sortify_word(const char *s, const char *end, string
&result)
}
}
-void sortify_other(const char *s, int len, string &key)
+static void sortify_other(const char *s, int len, string &key)
{
sortify_words(s, s + len, 0, key);
}
-void sortify_title(const char *s, int len, string &key)
+static void sortify_title(const char *s, int len, string &key)
{
const char *end = s + len;
for (; s < end && (*s == ' ' || *s == '\n'); s++)
@@ -352,7 +352,7 @@ void sortify_title(const char *s, int len, string &key)
sortify_words(s, end, 0, key);
}
-void sortify_name(const char *s, int len, string &key)
+static void sortify_name(const char *s, int len, string &key)
{
const char *last_name_end;
const char *last_name = find_last_name(s, s + len, &last_name_end);
@@ -365,7 +365,7 @@ void sortify_name(const char *s, int len, string &key)
sortify_words(last_name_end, s + len, ".,", key);
}
-void sortify_date(const char *s, int len, string &key)
+static void sortify_date(const char *s, int len, string &key)
{
const char *year_end;
const char *year_start = find_year(s, s + len, &year_end);
@@ -399,7 +399,7 @@ void sortify_date(const char *s, int len, string &key)
// SORT_{SUB,SUB_SUB}_SEP can creep in from use of @ in label specification.
-void sortify_label(const char *s, int len, string &key)
+static void sortify_label(const char *s, int len, string &key)
{
const char *end = s + len;
for (;;) {
@@ -672,7 +672,7 @@ void reverse_name(const char *ptr, const char *name_end,
string &result)
result.append(last_name_end, name_end - last_name_end);
}
-void reverse_names(string &result, int n)
+static void reverse_names(string &result, int n)
{
if (n <= 0)
return;
@@ -698,7 +698,7 @@ void reverse_names(string &result, int n)
// Return number of field separators.
-int join_fields(string &f)
+static int join_fields(string &f)
{
const char *ptr = f.contents();
int len = f.length();
@@ -784,14 +784,15 @@ void capitalize(const char *ptr, const char *end, string
&result)
result += "\\s+2";
}
-void capitalize_field(string &str)
+static void capitalize_field(string &str)
{
string temp;
capitalize(str.contents(), str.contents() + str.length(), temp);
str.move(temp);
}
-int is_terminated(const char *ptr, const char *end)
+// TODO: boolify
+static int is_terminated(const char *ptr, const char *end)
{
const char *last_token = end;
for (;;) {
diff --git a/src/preproc/refer/refer.cpp b/src/preproc/refer/refer.cpp
index 70d8da4c5..4d64e7c6e 100644
--- a/src/preproc/refer/refer.cpp
+++ b/src/preproc/refer/refer.cpp
@@ -979,7 +979,7 @@ void label_processing_state::process(int c)
extern "C" {
-int rcompare(const void *p1, const void *p2)
+static int rcompare(const void *p1, const void *p2)
{
// XXX: Would it make more sense to make non-const copies of p1, p2?
return compare_reference(
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit