]> granicus.if.org Git - check/commitdiff
Fix declaration of extern int errno
authorMikko Johannes Koivunalho <mikko.koivunalho@inoviagroup.se>
Wed, 14 Aug 2019 08:56:25 +0000 (10:56 +0200)
committerMikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Wed, 28 Aug 2019 11:03:25 +0000 (13:03 +0200)
if HAVE_VSNPRINTF is declared, <errno.h> is not included.
So we need to declare it ourselves.

Error (Travis SCAN_BUILD=YES):
libtool: compile:  /usr/local/clang-7.0.0/bin/../libexec/ccc-analyzer -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-variadic-macros -Wimport -Wfatal-errors -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wunknown-pragmas -MT snprintf.lo -MD -MP -MF .deps/snprintf.Tpo -c snprintf.c  -fPIC -DPIC -o .libs/snprintf.o
764snprintf.c:487:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
extern int errno;
^

Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@inoviagroup.se>
lib/snprintf.c

index b91b65c6efe4fad32f114184dc9ea25b6d03bf38..9beabbd28f4fa5b3bd4ca950c79fc581c0a57aca 100644 (file)
@@ -484,7 +484,12 @@ static UINTMAX_T cast(LDOUBLE);
 static UINTMAX_T myround(LDOUBLE);
 static LDOUBLE mypow10(int);
 
+#if HAVE_VSNPRINTF
+/* errno is imported from <errno.h> when available.
+ * Otherwise we declare it ourselves.
+ **/
 extern int errno;
+#endif
 
 int
 rpl_vsnprintf(char *str, size_t size, const char *format, va_list args)