Fixed a few warnings of GCC at "-Wall" level.

This commit is contained in:
LoRd_MuldeR 2022-12-03 14:50:12 +01:00
parent a1d8935b2b
commit 30d981a6ff
9 changed files with 14 additions and 15 deletions

View File

@ -1,6 +1,6 @@
include ../../config.mk
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../../libhashset/include $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -I../../libhashset/include $(XCFLAGS)
LDFLAGS = -L../../libhashset/lib -lhashset-1 $(XLDFLAGS)
SRC_PATH := src

View File

@ -1,6 +1,6 @@
include ../../config.mk
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../../libhashset/include $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -I../../libhashset/include $(XCFLAGS)
LDFLAGS = -L../../libhashset/lib -lhashset-1 $(XLDFLAGS)
SRC_PATH := src

View File

@ -1,6 +1,6 @@
include ../config.mk
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -Iinclude -fPIC $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -Iinclude -fPIC $(XCFLAGS)
SRC_PATH := src
OBJ_PATH := obj

View File

@ -3,6 +3,10 @@
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wpedantic"
#endif
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN 1
@ -21,9 +25,4 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
return TRUE;
}
#elif defined(__GNUC__)
void __attribute__((constructor)) libhashet_init(void) { /*noop*/ }
void __attribute__((destructor)) libhashet_exit(void) { /*noop*/ }
#endif

View File

@ -162,7 +162,7 @@ static INLINE size_t compute_limit(const size_t capacity, const double load_fact
static INLINE errno_t rebuild_map(hash_map_t *const instance, const size_t new_capacity)
{
size_t k, index;
size_t k, index = SIZE_MAX;
hash_data_t temp;
if (new_capacity < instance->valid)
@ -234,7 +234,7 @@ void DECLARE(hash_map_destroy)(hash_map_t *instance)
errno_t DECLARE(hash_map_insert)(hash_map_t *const instance, const value_t key, const value_t value)
{
size_t index;
size_t index = SIZE_MAX;
bool_t slot_reused;
if ((!instance) || (!instance->data.keys))

View File

@ -151,7 +151,7 @@ static INLINE size_t compute_limit(const size_t capacity, const double load_fact
static INLINE errno_t rebuild_set(hash_set_t *const instance, const size_t new_capacity)
{
size_t k, index;
size_t k, index = SIZE_MAX;
hash_data_t temp;
if (new_capacity < instance->valid)
@ -223,7 +223,7 @@ void DECLARE(hash_set_destroy)(hash_set_t *instance)
errno_t DECLARE(hash_set_insert)(hash_set_t *const instance, const value_t item)
{
size_t index;
size_t index = SIZE_MAX;
bool_t slot_reused;
if ((!instance) || (!instance->data.items))

View File

@ -1,6 +1,6 @@
include ../../config.mk
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../../libhashset/include -I../shared/include $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -I../../libhashset/include -I../shared/include $(XCFLAGS)
LDFLAGS = -L../../libhashset/lib -lhashset-1 $(XLDFLAGS)
SRC_PATH := src

View File

@ -1,6 +1,6 @@
include ../../config.mk
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -I../../libhashset/include -I../shared/include $(XCFLAGS)
CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wall -Wpedantic -I../../libhashset/include -I../shared/include $(XCFLAGS)
LDFLAGS = -L../../libhashset/lib -lhashset-1 $(XLDFLAGS)
SRC_PATH := src

View File

@ -101,7 +101,7 @@ int test_function_1(hash_set64_t *const hash_set)
for (i = 0; i < MAXIMUM; ++i)
{
const errno_t error = hash_set_contains64(hash_set, i);
if (error != ((i != 3167U) && (i != 9887U) && (i != 387083U)) ? 0 : ENOENT)
if (error != (((i != 3167U) && (i != 9887U) && (i != 387083U)) ? 0 : ENOENT))
{
printf("Contains operation has failed! (error: %d)\n", error);
return EXIT_FAILURE;