diff --git a/dnstap/unbound-dnstap-socket.c b/dnstap/unbound-dnstap-socket.c index 8c37654e8..8e28be4e8 100644 --- a/dnstap/unbound-dnstap-socket.c +++ b/dnstap/unbound-dnstap-socket.c @@ -727,7 +727,7 @@ static ssize_t tap_receive(struct tap_data* data, void* buf, size_t len) } /** delete the tap structure */ -void tap_data_free(struct tap_data* data) +static void tap_data_free(struct tap_data* data) { ub_event_del(data->ev); ub_event_free(data->ev); @@ -1355,6 +1355,10 @@ int main(int argc, char** argv) struct tube; struct query_info; #include "util/data/packed_rrset.h" +#include "daemon/worker.h" +#include "daemon/remote.h" +#include "util/fptr_wlist.h" +#include "libunbound/context.h" void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len), diff --git a/doc/Changelog b/doc/Changelog index dc4dee115..07a8e6ea4 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -6,6 +6,7 @@ missing prototype warnings. - Merge PR #373 from fobser: Warning: arithmetic on a pointer to void is a GNU extension. + - Fix missing prototypes in the code. 3 December 2020: Wouter - make depend. diff --git a/dynlibmod/dynlibmod.c b/dynlibmod/dynlibmod.c index 3bf9d1acb..3f148ebb6 100644 --- a/dynlibmod/dynlibmod.c +++ b/dynlibmod/dynlibmod.c @@ -5,16 +5,16 @@ * module actions. */ #include "config.h" +#include "dynlibmod/dynlibmod.h" #include "util/module.h" #include "util/config_file.h" -#include "dynlibmod/dynlibmod.h" #if HAVE_WINDOWS_H #include #define __DYNMOD HMODULE #define __DYNSYM FARPROC #define __LOADSYM GetProcAddress -void log_dlerror() { +static void log_dlerror() { DWORD dwLastError = GetLastError(); LPSTR MessageBuffer; DWORD dwBufferLength; @@ -37,11 +37,11 @@ void log_dlerror() { } -HMODULE open_library(const char* fname) { +static HMODULE open_library(const char* fname) { return LoadLibrary(fname); } -void close_library(const char* fname, __DYNMOD handle) { +static void close_library(const char* fname, __DYNMOD handle) { (void)fname; (void)handle; } @@ -50,15 +50,15 @@ void close_library(const char* fname, __DYNMOD handle) { #define __DYNMOD void* #define __DYNSYM void* #define __LOADSYM dlsym -void log_dlerror() { +static void log_dlerror() { log_err("dynlibmod: %s", dlerror()); } -void* open_library(const char* fname) { +static void* open_library(const char* fname) { return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL); } -void close_library(const char* fname, __DYNMOD handle) { +static void close_library(const char* fname, __DYNMOD handle) { if(!handle) return; if(dlclose(handle) != 0) { log_err("dlclose %s: %s", fname, strerror(errno)); diff --git a/libunbound/libworker.c b/libunbound/libworker.c index 06cbb8869..03bbaf768 100644 --- a/libunbound/libworker.c +++ b/libunbound/libworker.c @@ -73,6 +73,9 @@ #include "iterator/iter_hints.h" #include "sldns/sbuffer.h" #include "sldns/str2wire.h" +#ifdef USE_DNSTAP +#include "dnstap/dtstream.h" +#endif #ifdef HAVE_TARGETCONDITIONALS_H #include diff --git a/pythonmod/pythonmod_utils.c b/pythonmod/pythonmod_utils.c index 5d70f2b4b..9f7282540 100644 --- a/pythonmod/pythonmod_utils.c +++ b/pythonmod/pythonmod_utils.c @@ -39,6 +39,7 @@ * conversions. */ #include "config.h" +#include "pythonmod/pythonmod_utils.h" #include "util/module.h" #include "util/netevent.h" #include "util/net_help.h" diff --git a/pythonmod/pythonmod_utils.h b/pythonmod/pythonmod_utils.h index 768eb46de..4ea86f9be 100644 --- a/pythonmod/pythonmod_utils.h +++ b/pythonmod/pythonmod_utils.h @@ -43,6 +43,7 @@ #include "util/module.h" struct delegpt_addr; +struct sldns_buffer; /** * Store the reply_info and query_info pair in message cache (qstate->msg_cache) @@ -77,7 +78,7 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin * @param pkt: a sldns_buffer which contains sldns_packet data * @return 0 on failure, out of memory or parse error. */ -int createResponse(struct module_qstate* qstate, sldns_buffer* pkt); +int createResponse(struct module_qstate* qstate, struct sldns_buffer* pkt); /** * Convert reply->addr to string diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index 709c9e6ce..629d4de72 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -2793,7 +2793,7 @@ void http2_req_stream_clear(struct http2_stream* h2_stream) } } -nghttp2_session_callbacks* http2_req_callbacks_create() +nghttp2_session_callbacks* http2_req_callbacks_create(void) { nghttp2_session_callbacks *callbacks; if(nghttp2_session_callbacks_new(&callbacks) == NGHTTP2_ERR_NOMEM) { diff --git a/services/listen_dnsport.h b/services/listen_dnsport.h index 9d6ea2c33..f438ff458 100644 --- a/services/listen_dnsport.h +++ b/services/listen_dnsport.h @@ -404,7 +404,7 @@ size_t http2_get_response_buffer_size(void); * Create nghttp2 callbacks to handle HTTP2 requests. * @return malloc'ed struct, NULL on failure */ -nghttp2_session_callbacks* http2_req_callbacks_create(); +nghttp2_session_callbacks* http2_req_callbacks_create(void); /** Free http2 stream buffers and decrease buffer counters */ void http2_req_stream_clear(struct http2_stream* h2_stream); diff --git a/smallapp/worker_cb.c b/smallapp/worker_cb.c index 78d921a3c..cdf855dc3 100644 --- a/smallapp/worker_cb.c +++ b/smallapp/worker_cb.c @@ -46,6 +46,9 @@ #include "util/fptr_wlist.h" #include "util/log.h" #include "services/mesh.h" +#ifdef USE_DNSTAP +#include "dnstap/dtstream.h" +#endif void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len), diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 591557c35..75a6b8db9 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -64,6 +64,7 @@ #include "sldns/sbuffer.h" #include "sldns/wire2str.h" #include "sldns/str2wire.h" +#include "daemon/remote.h" #include struct worker; struct daemon_remote; diff --git a/testcode/testbound.c b/testcode/testbound.c index 3f3e106b0..5e10779fc 100644 --- a/testcode/testbound.c +++ b/testcode/testbound.c @@ -42,16 +42,22 @@ #ifdef HAVE_TIME_H # include #endif +#include #include "testcode/testpkts.h" #include "testcode/replay.h" #include "testcode/fake_event.h" #include "daemon/remote.h" +#include "libunbound/worker.h" #include "util/config_file.h" #include "sldns/keyraw.h" -#include +#ifdef UB_ON_WINDOWS +#include "winrc/win_svc.h" +#endif /** signal that this is a testbound compile */ #define unbound_testbound 1 +/** renamed main routine */ +int daemon_main(int argc, char* argv[]); /** * include the main program from the unbound daemon. * rename main to daemon_main to call it @@ -333,7 +339,7 @@ setup_playback(const char* filename, int* pass_argc, char* pass_argv[]) } /** remove config file at exit */ -void remove_configfile(void) +static void remove_configfile(void) { struct config_strlist* p; for(p=cfgfiles; p; p=p->next) @@ -551,22 +557,28 @@ void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg)) log_assert(0); } +#ifdef UB_ON_WINDOWS void wsvc_command_option(const char* ATTR_UNUSED(wopt), const char* ATTR_UNUSED(cfgfile), int ATTR_UNUSED(v), int ATTR_UNUSED(c)) { log_assert(0); } +#endif +#ifdef UB_ON_WINDOWS void wsvc_setup_worker(struct worker* ATTR_UNUSED(worker)) { /* do nothing */ } +#endif +#ifdef UB_ON_WINDOWS void wsvc_desetup_worker(struct worker* ATTR_UNUSED(worker)) { /* do nothing */ } +#endif #ifdef UB_ON_WINDOWS void worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),