From ebd87282196e4757db44e9d40823477b34484238 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 16 Jan 2023 19:14:28 +0100 Subject: [PATCH] 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. --- src/app-layer-htp-mem.c | 2 +- src/app-layer.c | 4 ++-- src/counters.c | 2 +- src/defrag-queue.c | 2 +- src/detect-engine-analyzer.c | 2 +- src/detect-engine-loader.c | 4 ++-- src/detect-engine-tag.c | 2 +- src/detect-engine.c | 2 +- src/flow-bypass.c | 2 +- src/flow-manager.c | 4 ++-- src/flow-queue.c | 2 +- src/host-queue.c | 2 +- src/ippair-queue.c | 2 +- src/log-cf-common.c | 4 ++-- src/runmode-af-packet.c | 2 +- src/runmode-dpdk.c | 2 +- src/runmode-netmap.c | 2 +- src/source-af-packet.c | 6 +++--- src/source-dpdk.c | 2 +- src/source-nfq.c | 2 +- src/source-pcap-file.c | 4 ++-- src/source-windivert.c | 2 +- src/stream-tcp-reassemble.c | 2 +- src/tm-threads.c | 4 ++-- src/util-action.c | 2 +- src/util-affinity.c | 2 +- src/util-conf.c | 4 ++-- src/util-debug-filters.c | 2 +- src/util-debug.c | 2 +- src/util-device.c | 4 ++-- src/util-hash-lookup3.c | 13 ++++++------- src/util-log-redis.c | 2 +- src/util-profiling-locks.c | 4 ++-- src/win32-syscall.c | 4 ++-- 34 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/app-layer-htp-mem.c b/src/app-layer-htp-mem.c index 8b13b75cca..bd9b79f676 100644 --- a/src/app-layer-htp-mem.c +++ b/src/app-layer-htp-mem.c @@ -40,7 +40,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 8b5f307cda..0e244caf20 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -1052,7 +1052,7 @@ void AppLayerRegisterGlobalCounters(void) } #define IPPROTOS_MAX 2 -void AppLayerSetupCounters() +void AppLayerSetupCounters(void) { const uint8_t ipprotos[] = { IPPROTO_TCP, IPPROTO_UDP }; AppProto alprotos[ALPROTO_MAX]; @@ -1173,7 +1173,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 56c0ab0e03..01ac449558 100644 --- a/src/counters.c +++ b/src/counters.c @@ -1265,7 +1265,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 0e29f16035..dccff8871f 100644 --- a/src/defrag-queue.c +++ b/src/defrag-queue.c @@ -38,7 +38,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 ebf2d0c5e0..94539cb475 100644 --- a/src/detect-engine-analyzer.c +++ b/src/detect-engine-analyzer.c @@ -431,7 +431,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}" int en; diff --git a/src/detect-engine-loader.c b/src/detect-engine-loader.c index 22fbf11f6f..1ec6944f4a 100644 --- a/src/detect-engine-loader.c +++ b/src/detect-engine-loader.c @@ -504,7 +504,7 @@ void DetectLoadersInit(void) /** * \brief Unpauses all threads present in tv_root */ -void TmThreadWakeupDetectLoaderThreads() +void TmThreadWakeupDetectLoaderThreads(void) { ThreadVars *tv = NULL; int i = 0; @@ -528,7 +528,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 8f2a12f062..12b8e9916a 100644 --- a/src/detect-engine-tag.c +++ b/src/detect-engine-tag.c @@ -78,7 +78,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 d0db2ec64c..f0d3b1bc7a 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -4861,7 +4861,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 98e62f519e..8dbb5ab17d 100644 --- a/src/flow-bypass.c +++ b/src/flow-bypass.c @@ -181,7 +181,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 4b0b5cf068..273eeda721 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -951,7 +951,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); @@ -1146,7 +1146,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 d6fc7c04de..1d4653b3bf 100644 --- a/src/flow-queue.c +++ b/src/flow-queue.c @@ -32,7 +32,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 3d400315f5..f81cb54c77 100644 --- a/src/host-queue.c +++ b/src/host-queue.c @@ -39,7 +39,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 d410d30a87..dac6b7e9c9 100644 --- a/src/ippair-queue.c +++ b/src/ippair-queue.c @@ -39,7 +39,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 b5ba712038..9b50544004 100644 --- a/src/log-cf-common.c +++ b/src/log-cf-common.c @@ -36,7 +36,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)) { @@ -51,7 +51,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 92107c78f1..1d22e5e9fc 100644 --- a/src/runmode-af-packet.c +++ b/src/runmode-af-packet.c @@ -676,7 +676,7 @@ static int AFPConfigGeThreadsCount(void *conf) return afp->threads; } -int AFPRunModeIsIPS() +int AFPRunModeIsIPS(void) { int nlive = LiveGetDeviceCount(); int ldev; diff --git a/src/runmode-dpdk.c b/src/runmode-dpdk.c index 479bb7febf..4a317b316c 100644 --- a/src/runmode-dpdk.c +++ b/src/runmode-dpdk.c @@ -252,7 +252,7 @@ static void ArgumentsAddOptionAndArgument(struct Arguments *args, const char *op SCReturn; } -static void InitEal() +static void InitEal(void) { SCEnter(); int retval; diff --git a/src/runmode-netmap.c b/src/runmode-netmap.c index 30e726f557..2a6ba13ac8 100644 --- a/src/runmode-netmap.c +++ b/src/runmode-netmap.c @@ -320,7 +320,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 39d5e03fd2..f139f0cc11 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -446,7 +446,7 @@ AFPPeersList peerslist; /** * \brief Init the global list of ::AFPPeer */ -TmEcode AFPPeersListInit() +TmEcode AFPPeersListInit(void) { SCEnter(); TAILQ_INIT(&peerslist.peers); @@ -463,7 +463,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 @@ -574,7 +574,7 @@ static int AFPPeersListStarted(void) /** * \brief Clean the global peers list. */ -void AFPPeersListClean() +void AFPPeersListClean(void) { AFPPeer *pitem; diff --git a/src/source-dpdk.c b/src/source-dpdk.c index e32611e99c..72aab475fb 100644 --- a/src/source-dpdk.c +++ b/src/source-dpdk.c @@ -184,7 +184,7 @@ static void DPDKSetTimevalReal(struct timeval *machine_start_tv, struct timeval } /* get number of seconds from the reset of TSC counter (typically from the machine start) */ -static uint64_t DPDKGetSeconds() +static uint64_t DPDKGetSeconds(void) { return CyclesToSeconds(rte_get_tsc_cycles()); } diff --git a/src/source-nfq.c b/src/source-nfq.c index b77b357f71..7fabb0c54c 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -1268,7 +1268,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 870f8f2d09..86a3cc54aa 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -135,7 +135,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); @@ -452,7 +452,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 c210c4373f..08a45a13bd 100644 --- a/src/source-windivert.c +++ b/src/source-windivert.c @@ -993,7 +993,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 f4f9955f40..742657cfc5 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -195,7 +195,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 1ad132865f..508d6ab719 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -1885,7 +1885,7 @@ again: /** * \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++) { @@ -2251,7 +2251,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 4d26c7e54d..1b24bc5b07 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 704ed49b96..c84de75f00 100644 --- a/src/util-affinity.c +++ b/src/util-affinity.c @@ -162,7 +162,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 47ee431c8c..0f01c7ead7 100644 --- a/src/util-conf.c +++ b/src/util-conf.c @@ -34,7 +34,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; @@ -81,7 +81,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 e539f5ea00..b8e0432f94 100644 --- a/src/util-debug-filters.c +++ b/src/util-debug-filters.c @@ -408,7 +408,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 bfac174852..60f67bac45 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -1818,7 +1818,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 e49ec8917e..313ce76d44 100644 --- a/src/util-device.c +++ b/src/util-device.c @@ -346,12 +346,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 0cfb2974ee..440df7ec6e 100644 --- a/src/util-log-redis.c +++ b/src/util-log-redis.c @@ -47,7 +47,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 c54e834cc4..00f9ef652a 100644 --- a/src/util-profiling-locks.c +++ b/src/util-profiling-locks.c @@ -95,7 +95,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); @@ -219,7 +219,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 37807f92e8..4e9145e118 100644 --- a/src/win32-syscall.c +++ b/src/win32-syscall.c @@ -314,7 +314,7 @@ release: /** * \brief get the maximum transmissible unit for all devices on the system */ -int GetGlobalMTUWin32() +int GetGlobalMTUWin32(void) { uint32_t mtu = 0; @@ -1653,7 +1653,7 @@ static int Win32TestStripPcapPrefix(void) } #endif /* UNITTESTS */ -void Win32SyscallRegisterTests() +void Win32SyscallRegisterTests(void) { #ifdef UNITTESTS UtRegisterTest("Win32TestStripPcapPrefix", Win32TestStripPcapPrefix); -- 2.47.3