Building a gnulib testdir with clang 16 and many warning options, I get
these warnings:

./vasnprintf.c:2204:1: warning: no previous prototype for function 
'c_vasnprintf' [-Wmissing-prototypes]
c-snprintf.c:41:1: warning: no previous prototype for function 'c_snprintf' 
[-Wmissing-prototypes]
c-vsnprintf.c:43:1: warning: no previous prototype for function 'c_vsnprintf' 
[-Wmissing-prototypes]

Missing prototypes in tests/ are harmless, but in lib/ it's worth looking at
and fixing. Here the problem is that the specification header has not been
included; this is not best practice.


2023-09-07  Bruno Haible  <[email protected]>

        c-*snprintf: Fix some clang -Wmissing-prototypes warnings.
        * lib/c-snprintf.c: Include c-snprintf.h instead of <stdio.h>.
        * lib/c-vsnprintf.c: Include c-vsnprintf.h instead of <stdio.h>.
        * lib/c-vasnprintf.c: Include c-vasnprintf.h.

diff --git a/lib/c-snprintf.c b/lib/c-snprintf.c
index 592e0e3cd4..305eb05832 100644
--- a/lib/c-snprintf.c
+++ b/lib/c-snprintf.c
@@ -19,7 +19,7 @@
 #include <config.h>
 
 /* Specification.  */
-#include <stdio.h>
+#include "c-snprintf.h"
 
 #include <errno.h>
 #include <limits.h>
diff --git a/lib/c-vasnprintf.c b/lib/c-vasnprintf.c
index 745e09cc07..92cde63172 100644
--- a/lib/c-vasnprintf.c
+++ b/lib/c-vasnprintf.c
@@ -16,6 +16,9 @@
 
 #include <config.h>
 
+/* Specification.  */
+#include "c-vasnprintf.h"
+
 #include <string.h>
 
 #include "printf-parse.h"
diff --git a/lib/c-vsnprintf.c b/lib/c-vsnprintf.c
index ffb975622a..cc63fd62d1 100644
--- a/lib/c-vsnprintf.c
+++ b/lib/c-vsnprintf.c
@@ -21,7 +21,7 @@
 #endif
 
 /* Specification.  */
-#include <stdio.h>
+#include "c-vsnprintf.h"
 
 #include <errno.h>
 #include <limits.h>




Reply via email to