Unverified Commit 5e3be1be authored by Madelyn Olson's avatar Madelyn Olson Committed by GitHub
Browse files

Remove prototypes with empty declarations (#12020)

Technically declaring a prototype with an empty declaration has been deprecated since the early days of C, but we never got a warning for it. C2x will apparently be introducing a breaking change if you are using this type of declarator, so Clang 15 has started issuing a warning with -pedantic. Although not apparently a problem for any of the compiler we build on, if feels like the right thing is to properly adhere to the C standard and use (void).
parent 8163e816
......@@ -40,7 +40,7 @@ ifneq (,$(findstring FreeBSD,$(uname_S)))
STD+=-Wno-c11-extensions
endif
endif
WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations
WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations -Wstrict-prototypes
OPT=$(OPTIMIZATION)
# Detect if the compiler supports C11 _Atomic.
......
......@@ -642,7 +642,7 @@ void ACLSetSelectorCommandBitsForCategory(dict *commands, aclSelector *selector,
/* This function is responsible for recomputing the command bits for all selectors of the existing users.
* It uses the 'command_rules', a string representation of the ordered categories and commands,
* to recompute the command bits. */
void ACLRecomputeCommandBitsFromCommandRulesAllUsers() {
void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void) {
raxIterator ri;
raxStart(&ri,Users);
raxSeek(&ri,"^",NULL,0);
......
......@@ -164,12 +164,12 @@ void aofManifestFree(aofManifest *am) {
zfree(am);
}
sds getAofManifestFileName() {
sds getAofManifestFileName(void) {
return sdscatprintf(sdsempty(), "%s%s", server.aof_filename,
MANIFEST_NAME_SUFFIX);
}
sds getTempAofManifestFileName() {
sds getTempAofManifestFileName(void) {
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX,
server.aof_filename, MANIFEST_NAME_SUFFIX);
}
......@@ -464,7 +464,7 @@ sds getNewIncrAofName(aofManifest *am) {
}
/* Get temp INCR type AOF name. */
sds getTempIncrAofName() {
sds getTempIncrAofName(void) {
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX, server.aof_filename,
INCR_FILE_SUFFIX);
}
......@@ -692,7 +692,7 @@ int aofDelHistoryFiles(void) {
}
/* Used to clean up temp INCR AOF when AOFRW fails. */
void aofDelTempIncrAofFile() {
void aofDelTempIncrAofFile(void) {
sds aof_filename = getTempIncrAofName();
sds aof_filepath = makePath(server.aof_dirname, aof_filename);
serverLog(LL_NOTICE, "Removing the temp incr aof file %s in the background", aof_filename);
......
......@@ -191,7 +191,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len)
/* Wrapper around OpenSSL (libssl and libcrypto) initialisation
*/
int cliSecureInit()
int cliSecureInit(void)
{
#ifdef USE_OPENSSL
ERR_load_crypto_strings();
......
......@@ -37,7 +37,7 @@ int cliSecureConnection(redisContext *c, cliSSLconfig config, const char **err);
ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len);
int cliSecureInit();
int cliSecureInit(void);
sds readArgFromStdin(void);
......
......@@ -126,7 +126,7 @@ dictType clusterNodesBlackListDictType = {
NULL /* allow to expand */
};
static ConnectionType *connTypeOfCluster() {
static ConnectionType *connTypeOfCluster(void) {
if (server.tls_cluster) {
return connectionTypeTls();
}
......@@ -2321,18 +2321,18 @@ uint32_t getAlignedPingExtSize(uint32_t dataSize) {
return sizeof(clusterMsgPingExt) + EIGHT_BYTE_ALIGN(dataSize);
}
uint32_t getHostnamePingExtSize() {
uint32_t getHostnamePingExtSize(void) {
if (sdslen(myself->hostname) == 0) {
return 0;
}
return getAlignedPingExtSize(sdslen(myself->hostname) + 1);
}
uint32_t getShardIdPingExtSize() {
uint32_t getShardIdPingExtSize(void) {
return getAlignedPingExtSize(sizeof(clusterMsgPingExtShardId));
}
uint32_t getForgottenNodeExtSize() {
uint32_t getForgottenNodeExtSize(void) {
return getAlignedPingExtSize(sizeof(clusterMsgPingExtForgottenNode));
}
......@@ -5559,7 +5559,7 @@ void clusterReplyMultiBulkSlots(client * c) {
setDeferredArrayLen(c, slot_replylen, num_masters);
}
sds genClusterInfoString() {
sds genClusterInfoString(void) {
sds info = sdsempty();
char *statestr[] = {"ok","fail"};
int slots_assigned = 0, slots_ok = 0, slots_pfail = 0, slots_fail = 0;
......
......@@ -423,7 +423,7 @@ void slotToChannelDel(sds channel);
void clusterUpdateMyselfHostname(void);
void clusterUpdateMyselfAnnouncedPorts(void);
sds clusterGenNodesDescription(int filter, int use_pport);
sds genClusterInfoString();
sds genClusterInfoString(void);
void freeClusterLink(clusterLink *link);
#endif /* __CLUSTER_H */
......@@ -1065,7 +1065,7 @@ void rewriteConfigReleaseState(struct rewriteConfigState *state) {
}
/* Create the configuration rewrite state */
struct rewriteConfigState *rewriteConfigCreateState() {
struct rewriteConfigState *rewriteConfigCreateState(void) {
struct rewriteConfigState *state = zmalloc(sizeof(*state));
state->option_to_line = dictCreate(&optionToLineDictType);
state->rewritten = dictCreate(&optionSetDictType);
......@@ -1643,7 +1643,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
/* This function returns a string representation of all the config options
* marked with DEBUG_CONFIG, which can be used to help with debugging. */
sds getConfigDebugInfo() {
sds getConfigDebugInfo(void) {
struct rewriteConfigState *state = rewriteConfigCreateState();
state->force_write = 1; /* Force the output */
state->needs_signature = 0; /* Omit the rewrite signature */
......@@ -3260,7 +3260,7 @@ int registerConfigValue(const char *name, const standardConfig *config, int alia
/* Initialize configs to their default values and create and populate the
* runtime configuration dictionary. */
void initConfigValues() {
void initConfigValues(void) {
configs = dictCreate(&sdsHashDictType);
dictExpand(configs, sizeof(static_configs) / sizeof(standardConfig));
for (standardConfig *config = static_configs; config->name != NULL; config++) {
......
......@@ -57,7 +57,7 @@ int connTypeRegister(ConnectionType *ct) {
return C_OK;
}
int connTypeInitialize() {
int connTypeInitialize(void) {
/* currently socket connection type is necessary */
serverAssert(RedisRegisterConnectionTypeSocket() == C_OK);
......@@ -88,7 +88,7 @@ ConnectionType *connectionByType(const char *typename) {
}
/* Cache TCP connection type, query it by string once */
ConnectionType *connectionTypeTcp() {
ConnectionType *connectionTypeTcp(void) {
static ConnectionType *ct_tcp = NULL;
if (ct_tcp != NULL)
......@@ -101,7 +101,7 @@ ConnectionType *connectionTypeTcp() {
}
/* Cache TLS connection type, query it by string once */
ConnectionType *connectionTypeTls() {
ConnectionType *connectionTypeTls(void) {
static ConnectionType *ct_tls = NULL;
static int cached = 0;
......@@ -116,7 +116,7 @@ ConnectionType *connectionTypeTls() {
}
/* Cache Unix connection type, query it by string once */
ConnectionType *connectionTypeUnix() {
ConnectionType *connectionTypeUnix(void) {
static ConnectionType *ct_unix = NULL;
if (ct_unix != NULL)
......@@ -141,7 +141,7 @@ int connectionIndexByType(const char *typename) {
return -1;
}
void connTypeCleanupAll() {
void connTypeCleanupAll(void) {
ConnectionType *ct;
int type;
......
......@@ -379,7 +379,7 @@ static inline sds connGetPeerCert(connection *conn) {
}
/* Initialize the redis connection framework */
int connTypeInitialize();
int connTypeInitialize(void);
/* Register a connection type into redis connection framework */
int connTypeRegister(ConnectionType *ct);
......@@ -388,13 +388,13 @@ int connTypeRegister(ConnectionType *ct);
ConnectionType *connectionByType(const char *typename);
/* Fast path to get TCP connection type */
ConnectionType *connectionTypeTcp();
ConnectionType *connectionTypeTcp(void);
/* Fast path to get TLS connection type */
ConnectionType *connectionTypeTls();
ConnectionType *connectionTypeTls(void);
/* Fast path to get Unix connection type */
ConnectionType *connectionTypeUnix();
ConnectionType *connectionTypeUnix(void);
/* Lookup the index of a connection type by type name, return -1 if not found */
int connectionIndexByType(const char *typename);
......@@ -418,7 +418,7 @@ static inline int connTypeConfigure(ConnectionType *ct, void *priv, int reconfig
}
/* Walk all the connection types and cleanup them all if possible */
void connTypeCleanupAll();
void connTypeCleanupAll(void);
/* Test all the connection type has pending data or not. */
int connTypeHasPendingData(void);
......@@ -441,8 +441,8 @@ static inline aeFileProc *connAcceptHandler(ConnectionType *ct) {
/* Get Listeners information, note that caller should free the non-empty string */
sds getListensInfoString(sds info);
int RedisRegisterConnectionTypeSocket();
int RedisRegisterConnectionTypeUnix();
int RedisRegisterConnectionTypeTLS();
int RedisRegisterConnectionTypeSocket(void);
int RedisRegisterConnectionTypeUnix(void);
int RedisRegisterConnectionTypeTLS(void);
#endif /* __REDIS_CONNECTION_H */
......@@ -562,7 +562,7 @@ int selectDb(client *c, int id) {
return C_OK;
}
long long dbTotalServerKeyCount() {
long long dbTotalServerKeyCount(void) {
long long total = 0;
int j;
for (j = 0; j < server.dbnum; j++) {
......
......@@ -2056,9 +2056,9 @@ void dumpCodeAroundEIP(void *eip) {
}
}
void invalidFunctionWasCalled() {}
void invalidFunctionWasCalled(void) {}
typedef void (*invalidFunctionWasCalledType)();
typedef void (*invalidFunctionWasCalledType)(void);
void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
UNUSED(secret);
......@@ -2227,7 +2227,7 @@ void watchdogScheduleSignal(int period) {
it.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &it, NULL);
}
void applyWatchdogPeriod() {
void applyWatchdogPeriod(void) {
struct sigaction act;
/* Disable watchdog when period is 0 */
......
......@@ -781,7 +781,7 @@ float getAllocatorFragmentation(size_t *out_frag_bytes) {
/* We may need to defrag other globals, one small allocation can hold a full allocator run.
* so although small, it is still important to defrag these */
void defragOtherGlobals() {
void defragOtherGlobals(void) {
/* there are many more pointers to defrag (e.g. client argv, output / aof buffers, etc.
* but we assume most of these are short lived, we only need to defrag allocations
......@@ -887,7 +887,7 @@ int defragLaterStep(redisDb *db, long long endtime) {
#define LIMIT(y, min, max) ((y)<(min)? min: ((y)>(max)? max: (y)))
/* decide if defrag is needed, and at what CPU effort to invest in it */
void computeDefragCycles() {
void computeDefragCycles(void) {
size_t frag_bytes;
float frag_pct = getAllocatorFragmentation(&frag_bytes);
/* If we're not already running, and below the threshold, exit. */
......
......@@ -650,15 +650,15 @@ NULL
}
}
unsigned long evalMemory() {
unsigned long evalMemory(void) {
return luaMemory(lctx.lua);
}
dict* evalScriptsDict() {
dict* evalScriptsDict(void) {
return lctx.lua_scripts;
}
unsigned long evalScriptsMemory() {
unsigned long evalScriptsMemory(void) {
return lctx.lua_scripts_mem +
dictMemUsage(lctx.lua_scripts) +
dictSize(lctx.lua_scripts) * sizeof(luaScript);
......@@ -688,7 +688,7 @@ void ldbFlushLog(list *log) {
listDelNode(log,ln);
}
int ldbIsEnabled(){
int ldbIsEnabled(void){
return ldb.active && ldb.step;
}
......
......@@ -494,7 +494,7 @@ static int isSafeToPerformEvictions(void) {
}
/* Algorithm for converting tenacity (0-100) to a time limit. */
static unsigned long evictionTimeLimitUs() {
static unsigned long evictionTimeLimitUs(void) {
serverAssert(server.maxmemory_eviction_tenacity >= 0);
serverAssert(server.maxmemory_eviction_tenacity <= 100);
......
......@@ -420,7 +420,7 @@ static int luaRegisterFunction(lua_State *lua) {
}
/* Initialize Lua engine, should be called once on start. */
int luaEngineInitEngine() {
int luaEngineInitEngine(void) {
luaEngineCtx *lua_engine_ctx = zmalloc(sizeof(*lua_engine_ctx));
lua_engine_ctx->lua = lua_open();
......
......@@ -212,12 +212,12 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *new_lib_ctx) {
}
/* return the current functions ctx */
functionsLibCtx* functionsLibCtxGetCurrent() {
functionsLibCtx* functionsLibCtxGetCurrent(void) {
return curr_functions_lib_ctx;
}
/* Create a new functions ctx */
functionsLibCtx* functionsLibCtxCreate() {
functionsLibCtx* functionsLibCtxCreate(void) {
functionsLibCtx *ret = zmalloc(sizeof(functionsLibCtx));
ret->libraries = dictCreate(&librariesDictType);
ret->functions = dictCreate(&functionDictType);
......@@ -1075,7 +1075,7 @@ void functionLoadCommand(client *c) {
}
/* Return memory usage of all the engines combine */
unsigned long functionsMemory() {
unsigned long functionsMemory(void) {
dictIterator *iter = dictGetIterator(engines);
dictEntry *entry = NULL;
size_t engines_nemory = 0;
......@@ -1090,7 +1090,7 @@ unsigned long functionsMemory() {
}
/* Return memory overhead of all the engines combine */
unsigned long functionsMemoryOverhead() {
unsigned long functionsMemoryOverhead(void) {
size_t memory_overhead = dictMemUsage(engines);
memory_overhead += dictMemUsage(curr_functions_lib_ctx->functions);
memory_overhead += sizeof(functionsLibCtx);
......@@ -1101,15 +1101,15 @@ unsigned long functionsMemoryOverhead() {
}
/* Returns the number of functions */
unsigned long functionsNum() {
unsigned long functionsNum(void) {
return dictSize(curr_functions_lib_ctx->functions);
}
unsigned long functionsLibNum() {
unsigned long functionsLibNum(void) {
return dictSize(curr_functions_lib_ctx->libraries);
}
dict* functionsLibGet() {
dict* functionsLibGet(void) {
return curr_functions_lib_ctx->libraries;
}
......@@ -1119,7 +1119,7 @@ size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx) {
/* Initialize engine data structures.
* Should be called once on server initialization */
int functionsInit() {
int functionsInit(void) {
engines = dictCreate(&engineDictType);
if (luaEngineInitEngine() != C_OK) {
......
......@@ -110,14 +110,14 @@ struct functionLibInfo {
int functionsRegisterEngine(const char *engine_name, engine *engine_ctx);
sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibCtx *lib_ctx);
unsigned long functionsMemory();
unsigned long functionsMemoryOverhead();
unsigned long functionsNum();
unsigned long functionsLibNum();
dict* functionsLibGet();
unsigned long functionsMemory(void);
unsigned long functionsMemoryOverhead(void);
unsigned long functionsNum(void);
unsigned long functionsLibNum(void);
dict* functionsLibGet(void);
size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx);
functionsLibCtx* functionsLibCtxGetCurrent();
functionsLibCtx* functionsLibCtxCreate();
functionsLibCtx* functionsLibCtxGetCurrent(void);
functionsLibCtx* functionsLibCtxCreate(void);
void functionsLibCtxClearCurrent(int async);
void functionsLibCtxFree(functionsLibCtx *lib_ctx);
void functionsLibCtxClear(functionsLibCtx *lib_ctx);
......@@ -125,7 +125,7 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *lib_ctx);
int functionLibCreateFunction(sds name, void *function, functionLibInfo *li, sds desc, uint64_t f_flags, sds *err);
int luaEngineInitEngine();
int functionsInit();
int luaEngineInitEngine(void);
int functionsInit(void);
#endif /* __FUNCTIONS_H_ */
......@@ -82,7 +82,7 @@ size_t lazyfreeGetFreedObjectsCount(void) {
return aux;
}
void lazyfreeResetStats() {
void lazyfreeResetStats(void) {
atomicSet(lazyfreed_objects,0);
}
......
......@@ -1693,7 +1693,7 @@ char *mixlist[] = {"hello", "foo", "quux", "1024"};
char *intlist[] = {"4294967296", "-100", "100", "128000",
"non integer", "much much longer non integer"};
static unsigned char *createList() {
static unsigned char *createList(void) {
unsigned char *lp = lpNew(0);
lp = lpAppend(lp, (unsigned char*)mixlist[1], strlen(mixlist[1]));
lp = lpAppend(lp, (unsigned char*)mixlist[2], strlen(mixlist[2]));
......@@ -1702,7 +1702,7 @@ static unsigned char *createList() {
return lp;
}
static unsigned char *createIntList() {
static unsigned char *createIntList(void) {
unsigned char *lp = lpNew(0);
lp = lpAppend(lp, (unsigned char*)intlist[2], strlen(intlist[2]));
lp = lpAppend(lp, (unsigned char*)intlist[3], strlen(intlist[3]));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment