From: Victor Julien Date: Mon, 16 Jan 2023 18:14:28 +0000 (+0100) Subject: src: fix strict-prototype warnings X-Git-Tag: suricata-6.0.10~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f6862cb50f91ea709f09008b9192054cb2cdf24;p=thirdparty%2Fsuricata.git src: fix strict-prototype warnings Tested on Fedora 37 with clang 15. app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] void AppLayerSetupCounters() ^ void app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] void AppLayerDeSetupCounters() ^ void 2 errors generated. (cherry picked from commit ebd87282196e4757db44e9d40823477b34484238) --- diff --git a/src/app-layer-htp-mem.c b/src/app-layer-htp-mem.c index e1893f1e90..edbfa97093 100644 --- a/src/app-layer-htp-mem.c +++ b/src/app-layer-htp-mem.c @@ -42,7 +42,7 @@ SC_ATOMIC_DECLARE(uint64_t, htp_config_memcap); SC_ATOMIC_DECLARE(uint64_t, htp_memuse); SC_ATOMIC_DECLARE(uint64_t, htp_memcap); -void HTPParseMemcap() +void HTPParseMemcap(void) { const char *conf_val; diff --git a/src/app-layer.c b/src/app-layer.c index e0301b9689..3e75037ab1 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -949,7 +949,7 @@ void AppLayerRegisterGlobalCounters(void) } #define IPPROTOS_MAX 2 -void AppLayerSetupCounters() +void AppLayerSetupCounters(void) { uint8_t ipprotos[] = { IPPROTO_TCP, IPPROTO_UDP }; uint8_t ipproto; @@ -1022,7 +1022,7 @@ void AppLayerRegisterThreadCounters(ThreadVars *tv) } } -void AppLayerDeSetupCounters() +void AppLayerDeSetupCounters(void) { memset(applayer_counter_names, 0, sizeof(applayer_counter_names)); memset(applayer_counters, 0, sizeof(applayer_counters)); diff --git a/src/counters.c b/src/counters.c index 2d9fabeca9..b96062c88f 100644 --- a/src/counters.c +++ b/src/counters.c @@ -1252,7 +1252,7 @@ uint64_t StatsGetLocalCounterValue(ThreadVars *tv, uint16_t id) /** * \brief Releases the resources alloted by the Stats API */ -void StatsReleaseResources() +void StatsReleaseResources(void) { StatsLogSummary(); StatsReleaseCtx(); diff --git a/src/defrag-queue.c b/src/defrag-queue.c index 71dcb9329e..771693d590 100644 --- a/src/defrag-queue.c +++ b/src/defrag-queue.c @@ -40,7 +40,7 @@ DefragTrackerQueue *DefragTrackerQueueInit (DefragTrackerQueue *q) return q; } -DefragTrackerQueue *DefragTrackerQueueNew() +DefragTrackerQueue *DefragTrackerQueueNew(void) { DefragTrackerQueue *q = (DefragTrackerQueue *)SCMalloc(sizeof(DefragTrackerQueue)); if (q == NULL) { diff --git a/src/detect-engine-analyzer.c b/src/detect-engine-analyzer.c index 9ae652d772..e4a15a38ce 100644 --- a/src/detect-engine-analyzer.c +++ b/src/detect-engine-analyzer.c @@ -425,7 +425,7 @@ void CleanupRuleAnalyzer(void) * \retval 1 if successful * \retval 0 if on error */ -int PerCentEncodingSetup () +int PerCentEncodingSetup(void) { #define DETECT_PERCENT_ENCODING_REGEX "%[0-9|a-f|A-F]{2}" const char *eb = NULL; diff --git a/src/detect-engine-loader.c b/src/detect-engine-loader.c index 271c31e950..c7fb8657b9 100644 --- a/src/detect-engine-loader.c +++ b/src/detect-engine-loader.c @@ -493,7 +493,7 @@ void DetectLoadersInit(void) /** * \brief Unpauses all threads present in tv_root */ -void TmThreadWakeupDetectLoaderThreads() +void TmThreadWakeupDetectLoaderThreads(void) { ThreadVars *tv = NULL; int i = 0; @@ -517,7 +517,7 @@ void TmThreadWakeupDetectLoaderThreads() /** * \brief Unpauses all threads present in tv_root */ -void TmThreadContinueDetectLoaderThreads() +void TmThreadContinueDetectLoaderThreads(void) { ThreadVars *tv = NULL; int i = 0; diff --git a/src/detect-engine-tag.c b/src/detect-engine-tag.c index 505ff443fd..1c446b8a1f 100644 --- a/src/detect-engine-tag.c +++ b/src/detect-engine-tag.c @@ -77,7 +77,7 @@ void TagDestroyCtx(void) /** \brief Reset the tagging engine context */ -void TagRestartCtx() +void TagRestartCtx(void) { TagDestroyCtx(); TagInitCtx(); diff --git a/src/detect-engine.c b/src/detect-engine.c index 4bb2cde847..c89586cbf7 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -4582,7 +4582,7 @@ static int DetectEngineTest09(void) #endif -void DetectEngineRegisterTests() +void DetectEngineRegisterTests(void) { #ifdef UNITTESTS UtRegisterTest("DetectEngineTest01", DetectEngineTest01); diff --git a/src/flow-bypass.c b/src/flow-bypass.c index 9b4e75e702..14cceaeaa6 100644 --- a/src/flow-bypass.c +++ b/src/flow-bypass.c @@ -180,7 +180,7 @@ int BypassedFlowManagerRegisterUpdateFunc(BypassedUpdateFunc UpdateFunc, #endif /** \brief spawn the flow bypass manager thread */ -void BypassedFlowManagerThreadSpawn() +void BypassedFlowManagerThreadSpawn(void) { #ifdef CAPTURE_OFFLOAD_MANAGER diff --git a/src/flow-manager.c b/src/flow-manager.c index 71e15828db..cdb611c07e 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -1028,7 +1028,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data) } /** \brief spawn the flow manager thread */ -void FlowManagerThreadSpawn() +void FlowManagerThreadSpawn(void) { intmax_t setting = 1; (void)ConfGetInt("flow.managers", &setting); @@ -1243,7 +1243,7 @@ static bool FlowRecyclerReadyToShutdown(void) } /** \brief spawn the flow recycler thread */ -void FlowRecyclerThreadSpawn() +void FlowRecyclerThreadSpawn(void) { intmax_t setting = 1; (void)ConfGetInt("flow.recyclers", &setting); diff --git a/src/flow-queue.c b/src/flow-queue.c index 530cab3db7..6ec98a394d 100644 --- a/src/flow-queue.c +++ b/src/flow-queue.c @@ -33,7 +33,7 @@ #include "util-debug.h" #include "util-print.h" -FlowQueue *FlowQueueNew() +FlowQueue *FlowQueueNew(void) { FlowQueue *q = (FlowQueue *)SCMalloc(sizeof(FlowQueue)); if (q == NULL) { diff --git a/src/host-queue.c b/src/host-queue.c index 2ef1628d33..6c3144afcc 100644 --- a/src/host-queue.c +++ b/src/host-queue.c @@ -40,7 +40,7 @@ HostQueue *HostQueueInit (HostQueue *q) return q; } -HostQueue *HostQueueNew() +HostQueue *HostQueueNew(void) { HostQueue *q = (HostQueue *)SCMalloc(sizeof(HostQueue)); if (q == NULL) { diff --git a/src/ippair-queue.c b/src/ippair-queue.c index 0f68200dd9..992ed9d869 100644 --- a/src/ippair-queue.c +++ b/src/ippair-queue.c @@ -40,7 +40,7 @@ IPPairQueue *IPPairQueueInit (IPPairQueue *q) return q; } -IPPairQueue *IPPairQueueNew() +IPPairQueue *IPPairQueueNew(void) { IPPairQueue *q = (IPPairQueue *)SCMalloc(sizeof(IPPairQueue)); if (q == NULL) { diff --git a/src/log-cf-common.c b/src/log-cf-common.c index 35a3168eaf..1e6ea24681 100644 --- a/src/log-cf-common.c +++ b/src/log-cf-common.c @@ -34,7 +34,7 @@ * \retval LogCustomFormatNode * ptr if created * \retval NULL if failed to allocate */ -LogCustomFormatNode * LogCustomFormatNodeAlloc() +LogCustomFormatNode *LogCustomFormatNodeAlloc(void) { LogCustomFormatNode * node = SCCalloc(1, sizeof(LogCustomFormatNode)); if (unlikely(node == NULL)) { @@ -49,7 +49,7 @@ LogCustomFormatNode * LogCustomFormatNodeAlloc() * \retval LogCustomFormat * ptr if created * \retval NULL if failed to allocate */ -LogCustomFormat * LogCustomFormatAlloc() +LogCustomFormat *LogCustomFormatAlloc(void) { LogCustomFormat * cf = SCCalloc(1, sizeof(LogCustomFormat)); if (unlikely(cf == NULL)) { diff --git a/src/runmode-af-packet.c b/src/runmode-af-packet.c index 12bfbfb659..2f239df66d 100644 --- a/src/runmode-af-packet.c +++ b/src/runmode-af-packet.c @@ -717,7 +717,7 @@ static int AFPConfigGeThreadsCount(void *conf) return afp->threads; } -int AFPRunModeIsIPS() +int AFPRunModeIsIPS(void) { int nlive = LiveGetDeviceCount(); int ldev; diff --git a/src/runmode-netmap.c b/src/runmode-netmap.c index 9e31b08b20..5d104c0717 100644 --- a/src/runmode-netmap.c +++ b/src/runmode-netmap.c @@ -373,7 +373,7 @@ static int NetmapConfigGeThreadsCount(void *conf) return aconf->in.threads; } -int NetmapRunModeIsIPS() +int NetmapRunModeIsIPS(void) { int nlive = LiveGetDeviceCount(); int ldev; diff --git a/src/source-af-packet.c b/src/source-af-packet.c index db8d79307d..0ba20bb471 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -437,7 +437,7 @@ AFPPeersList peerslist; /** * \brief Init the global list of ::AFPPeer */ -TmEcode AFPPeersListInit() +TmEcode AFPPeersListInit(void) { SCEnter(); TAILQ_INIT(&peerslist.peers); @@ -454,7 +454,7 @@ TmEcode AFPPeersListInit() * * \retval TM_ECODE_FAILED if some threads are not peered or TM_ECODE_OK else. */ -TmEcode AFPPeersListCheck() +TmEcode AFPPeersListCheck(void) { #define AFP_PEERS_MAX_TRY 4 #define AFP_PEERS_WAIT 20000 @@ -569,7 +569,7 @@ static int AFPPeersListStarted(void) /** * \brief Clean the global peers list. */ -void AFPPeersListClean() +void AFPPeersListClean(void) { AFPPeer *pitem; diff --git a/src/source-nfq.c b/src/source-nfq.c index 3f708eb188..a6d2e5e5ea 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -1271,7 +1271,7 @@ TmEcode DecodeNFQThreadDeinit(ThreadVars *tv, void *data) /** * \brief Clean global contexts. Must be called on exit. */ -void NFQContextsClean() +void NFQContextsClean(void) { if (g_nfq_q != NULL) { SCFree(g_nfq_q); diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index 4b2c28550d..0605c44c28 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -133,7 +133,7 @@ void TmModuleDecodePcapFileRegister (void) tmm_modules[TMM_DECODEPCAPFILE].flags = TM_FLAG_DECODE_TM; } -void PcapFileGlobalInit() +void PcapFileGlobalInit(void) { memset(&pcap_g, 0x00, sizeof(pcap_g)); SC_ATOMIC_INIT(pcap_g.invalid_checksums); @@ -461,7 +461,7 @@ TmEcode DecodePcapFileThreadDeinit(ThreadVars *tv, void *data) SCReturnInt(TM_ECODE_OK); } -void PcapIncreaseInvalidChecksum() +void PcapIncreaseInvalidChecksum(void) { (void) SC_ATOMIC_ADD(pcap_g.invalid_checksums, 1); } diff --git a/src/source-windivert.c b/src/source-windivert.c index 3701310d72..95d99845ac 100644 --- a/src/source-windivert.c +++ b/src/source-windivert.c @@ -1000,7 +1000,7 @@ static int SourceWinDivertTestIfaceMatchFilter(void) /** * \brief this function registers unit tests for the WinDivert Source */ -void SourceWinDivertRegisterTests() +void SourceWinDivertRegisterTests(void) { #ifdef UNITTESTS UtRegisterTest("SourceWinDivertTestIfaceMatchFilter", diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 670182111c..aab148eaf1 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -184,7 +184,7 @@ int StreamTcpReassembleSetMemcap(uint64_t size) * * \return memcap memcap value */ -uint64_t StreamTcpReassembleGetMemcap() +uint64_t StreamTcpReassembleGetMemcap(void) { uint64_t memcapcopy = SC_ATOMIC_GET(stream_config.reassembly_memcap); return memcapcopy; diff --git a/src/tm-threads.c b/src/tm-threads.c index 2b81856bbc..367c85ab95 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -1864,7 +1864,7 @@ void TmThreadContinue(ThreadVars *tv) /** * \brief Unpauses all threads present in tv_root */ -void TmThreadContinueThreads() +void TmThreadContinueThreads(void) { SCMutexLock(&tv_root_lock); for (int i = 0; i < TVT_MAX; i++) { @@ -1892,7 +1892,7 @@ void TmThreadPause(ThreadVars *tv) /** * \brief Pauses all threads present in tv_root */ -void TmThreadPauseThreads() +void TmThreadPauseThreads(void) { TmThreadsListThreads(); @@ -2291,7 +2291,7 @@ void TmThreadsGetMinimalTimestamp(struct timeval *ts) SCLogDebug("ts->tv_sec %"PRIuMAX, (uintmax_t)ts->tv_sec); } -uint16_t TmThreadsGetWorkerThreadMax() +uint16_t TmThreadsGetWorkerThreadMax(void) { uint16_t ncpus = UtilCpuGetNumProcessorsOnline(); int thread_max = TmThreadGetNbThreads(WORKER_CPU_SET); diff --git a/src/util-action.c b/src/util-action.c index a4afdd5d30..5950eb9629 100644 --- a/src/util-action.c +++ b/src/util-action.c @@ -95,7 +95,7 @@ static uint8_t ActionAsciiToFlag(const char *action) * * \retval 0 on success; -1 on fatal error; */ -int ActionInitConfig() +int ActionInitConfig(void) { uint8_t actions_used = 0; uint8_t action_flag = 0; diff --git a/src/util-affinity.c b/src/util-affinity.c index 3a9c8f08a1..1cf4af8a3b 100644 --- a/src/util-affinity.c +++ b/src/util-affinity.c @@ -177,7 +177,7 @@ static void BuildCpuset(const char *name, ConfNode *node, cpu_set_t *cpu) * \brief Extract cpu affinity configuration from current config file */ -void AffinitySetupLoadFromConfig() +void AffinitySetupLoadFromConfig(void) { #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun ConfNode *root = ConfGetNode("threading.cpu-affinity"); diff --git a/src/util-conf.c b/src/util-conf.c index a135b4b388..da337c6b4b 100644 --- a/src/util-conf.c +++ b/src/util-conf.c @@ -32,7 +32,7 @@ TmEcode ConfigSetLogDirectory(const char *name) return ConfSetFinal("default-log-dir", name) ? TM_ECODE_OK : TM_ECODE_FAILED; } -const char *ConfigGetLogDirectory() +const char *ConfigGetLogDirectory(void) { const char *log_dir = NULL; @@ -79,7 +79,7 @@ TmEcode ConfigSetDataDirectory(char *name) return ConfSetFinal("default-data-dir", tmp) ? TM_ECODE_OK : TM_ECODE_FAILED; } -const char *ConfigGetDataDirectory() +const char *ConfigGetDataDirectory(void) { const char *data_dir = NULL; diff --git a/src/util-debug-filters.c b/src/util-debug-filters.c index a94db699a5..16d5ac470b 100644 --- a/src/util-debug-filters.c +++ b/src/util-debug-filters.c @@ -405,7 +405,7 @@ void SCLogReleaseFGFilters(void) * * \retval count The no of FG filters */ -int SCLogPrintFGFilters() +int SCLogPrintFGFilters(void) { SCLogFGFilterFile *fgf_file = NULL; SCLogFGFilterFunc *fgf_func = NULL; diff --git a/src/util-debug.c b/src/util-debug.c index 4303f828cb..9889219f77 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -1725,7 +1725,7 @@ static int SCLogTestInit05(void) #endif /* UNITTESTS */ -void SCLogRegisterTests() +void SCLogRegisterTests(void) { #ifdef UNITTESTS diff --git a/src/util-device.c b/src/util-device.c index 0faf9b9391..6c89ca6363 100644 --- a/src/util-device.c +++ b/src/util-device.c @@ -339,12 +339,12 @@ int LiveBuildDeviceListCustom(const char *runmode, const char *itemname) * * This can be useful in the case, this is not a real interface. */ -void LiveDeviceHasNoStats() +void LiveDeviceHasNoStats(void) { live_devices_stats = 0; } -int LiveDeviceListClean() +int LiveDeviceListClean(void) { SCEnter(); LiveDevice *pd, *tpd; diff --git a/src/util-hash-lookup3.c b/src/util-hash-lookup3.c index bd47eacc07..d341be3665 100644 --- a/src/util-hash-lookup3.c +++ b/src/util-hash-lookup3.c @@ -940,7 +940,7 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval) #ifdef SELF_TEST /* used for timings */ -void driver1() +void driver1(void) { uint8_t buf[256]; uint32_t i; @@ -962,7 +962,7 @@ void driver1() #define HASHLEN 1 #define MAXPAIR 60 #define MAXLEN 70 -void driver2() +void driver2(void) { uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z; @@ -1032,7 +1032,7 @@ void driver2() } /* Check for reading beyond the end of the buffer and alignment problems */ -void driver3() +void driver3(void) { uint8_t buf[MAXLEN+20], *b; uint32_t len; @@ -1123,7 +1123,7 @@ void driver3() } /* check for problems with nulls */ - void driver4() +void driver4(void) { uint8_t buf[1]; uint32_t h,i,state[HASHSTATE]; @@ -1139,7 +1139,7 @@ void driver3() } } -void driver5() +void driver5(void) { uint32_t b,c; b=0, c=0, hashlittle2("", 0, &c, &b); @@ -1160,8 +1160,7 @@ void driver5() printf("hash is %.8lx\n", c); /* cd628161 */ } - -int main() +int main(void) { driver1(); /* test that the key is hashed: used for timings */ driver2(); /* test that whole key is hashed thoroughly */ diff --git a/src/util-log-redis.c b/src/util-log-redis.c index 4f437f02ba..ff5b8605bc 100644 --- a/src/util-log-redis.c +++ b/src/util-log-redis.c @@ -46,7 +46,7 @@ static void SCLogFileCloseRedis(LogFileCtx *log_ctx); /** * \brief SCLogRedisInit() - Initializes global stuff before threads */ -void SCLogRedisInit() +void SCLogRedisInit(void) { #ifdef HAVE_LIBEVENT_PTHREADS evthread_use_pthreads(); diff --git a/src/util-profiling-locks.c b/src/util-profiling-locks.c index 0840750596..0ec26ed58b 100644 --- a/src/util-profiling-locks.c +++ b/src/util-profiling-locks.c @@ -93,7 +93,7 @@ static void LockRecordFree(void *data) SCFree(fn); } -int LockRecordInitHash() +int LockRecordInitHash(void) { pthread_mutex_init(&lock_records_mutex, NULL); pthread_mutex_lock(&lock_records_mutex); @@ -218,7 +218,7 @@ static void SCProfilingListLocks(void) fclose(fp); } -void LockRecordFreeHash() +void LockRecordFreeHash(void) { if (profiling_locks_enabled == 0) return; diff --git a/src/win32-syscall.c b/src/win32-syscall.c index 0c2789264d..3acba2c9bf 100644 --- a/src/win32-syscall.c +++ b/src/win32-syscall.c @@ -315,7 +315,7 @@ release: /** * \brief get the maximum transmissible unit for all devices on the system */ -int GetGlobalMTUWin32() +int GetGlobalMTUWin32(void) { uint32_t mtu = 0; @@ -1682,7 +1682,7 @@ static int Win32TestStripPcapPrefix(void) } #endif /* UNITTESTS */ -void Win32SyscallRegisterTests() +void Win32SyscallRegisterTests(void) { #ifdef UNITTESTS UtRegisterTest("Win32TestStripPcapPrefix", Win32TestStripPcapPrefix);