From 1d5a71656432e9a55cfd2d9662cccf2e31ce1d52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Sat, 2 Apr 2022 20:46:44 +0200 Subject: [PATCH] tests: Fix headers inclusion Bulding on musl standard library revealed two issues: (1) A missing header file from server_cli.c: x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/libxml2 -I../../src -DSRCDIR=\"../..\" -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -std=c99 -Wall -c server_cli.c [...] server_cli.c: In function 'main': server_cli.c:91:28: warning: implicit declaration of function 'getopt' [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 91 | while (-1 != (option = getopt(argc, argv, "h:p:t:u:a:s:S:c:"))) { | ^~~~~~ server_cli.c:95:28: error: 'optarg' undeclared (first use in this function) 95 | otp_code = optarg; | ^~~~~~ server_cli.c:95:28: note: each undeclared identifier is reported only once for each function it appears in server_cli.c:125:9: error: 'optind' undeclared (first use in this function); did you mean 'option'? 125 | if (optind != argc) { | ^~~~~~ | option The compilation unit forgot to include . (2) Badly named in server.c: x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/libxml2 -I../../src -DSRCDIR=\"../..\" -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -std=c99 -Wall -c server.c -fPIC -DPIC -o .libs/libserver_la-server.o [...] In file included from server.c:26: /usr/include/wait.h:1:2: warning: #warning redirecting incorrect #include to [-Wcpp[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcpp]] 1 | #warning redirecting incorrect #include to | ^~~~~~~ The compilation unit misnamed . This patch fixes both these issues. https://bugs.gentoo.org/show_bug.cgi?id=836628 --- test/simline/server.c | 2 +- test/simline/server_cli.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/simline/server.c b/test/simline/server.c index c5412ea..d104188 100644 --- a/test/simline/server.c +++ b/test/simline/server.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/test/simline/server_cli.c b/test/simline/server_cli.c index 4548f98..130e439 100644 --- a/test/simline/server_cli.c +++ b/test/simline/server_cli.c @@ -9,6 +9,7 @@ #include #include /* For pid_t */ #include /* memset() */ +#include /* for getopt() */ static const char *username = NULL; static const char *password = NULL; -- 2.11.4.GIT