Add -Wextra compiler flag

This commit is contained in:
2022-11-16 23:06:44 -05:00
parent c67d4f4583
commit e1048c3ca4
3 changed files with 5 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ test_lib_includes = ["third-party/unity/src/"]
VariantDir(variant_dir, ".", duplicate=0) VariantDir(variant_dir, ".", duplicate=0)
# Minimization flags for later: # Minimization flags for later:
# CCFLAGS = ["-Oz", "-flto", "-ffunction-sections", "-fdata-sections", "-Wl,--gc-sections", "-lreadline"] # CCFLAGS = ["-Oz", "-flto", "-ffunction-sections", "-fdata-sections", "-Wl,--gc-sections", "-lreadline"]
CCFLAGS = ["-ggdb", "-O0", "-Werror", "-Wall"] CCFLAGS = ["-ggdb", "-O0", "-Werror", "-Wall", "-Wextra", "-Wno-unused-parameter"]
env = Environment( env = Environment(
CPPPATH=lib_includes, COMPILATIONDB_USE_ABSPATH=True, CCFLAGS=CCFLAGS CPPPATH=lib_includes, COMPILATIONDB_USE_ABSPATH=True, CCFLAGS=CCFLAGS
) )

View File

@@ -36,7 +36,7 @@ struct ucl_arena *ucl_arena_create(size_t object_size, size_t capacity) {
void ucl_arena_map(struct ucl_arena *arena, void (*map_function)(struct ucl_arena * arena, void *object)) { void ucl_arena_map(struct ucl_arena *arena, void (*map_function)(struct ucl_arena * arena, void *object)) {
size_t used_map_ints = DIV_ROUND_UP(arena->capacity, INT_BITS); size_t used_map_ints = DIV_ROUND_UP(arena->capacity, INT_BITS);
for (int i = 0; i < used_map_ints; i++ ) { for (unsigned int i = 0; i < used_map_ints; i++ ) {
// TODO: Allow for 'put' in map // TODO: Allow for 'put' in map
int map = arena->used_map[i]; int map = arena->used_map[i];
while (map) { while (map) {
@@ -60,8 +60,8 @@ void *ucl_arena_get(struct ucl_arena *arena) {
continue; continue;
} }
int bit_index = __builtin_ffs(~map) - 1; unsigned int bit_index = __builtin_ffs(~map) - 1;
int index = bit_index + INT_BITS * i; unsigned int index = bit_index + INT_BITS * i;
if (index >= arena->capacity) { if (index >= arena->capacity) {
// This might happen in the last used_map_int when (capacity % int_bits != 0) // This might happen in the last used_map_int when (capacity % int_bits != 0)
return NULL; return NULL;
@@ -88,7 +88,6 @@ void ucl_arena_put(struct ucl_arena *arena, void *object) {
unsigned int bit_index = index % INT_BITS; unsigned int bit_index = index % INT_BITS;
assert(offset % arena->object_size == 0); assert(offset % arena->object_size == 0);
assert(index >= 0);
assert(index < arena->capacity); assert(index < arena->capacity);
assert(arena->used_map[int_index] & (1 << bit_index)); assert(arena->used_map[int_index] & (1 << bit_index));

View File

@@ -127,7 +127,7 @@ struct ucl_object *ucl_parse_token_atom(struct ucl_object *maybe_atom) {
break; break;
case UCL_TYPE_SYMBOL: { case UCL_TYPE_SYMBOL: {
// Check for reserved tokens first, which indicate special, non-atom behavior // Check for reserved tokens first, which indicate special, non-atom behavior
for (int i = 0; i < ARRAY_SIZE(reserved_symbols); i++) { for (unsigned int i = 0; i < ARRAY_SIZE(reserved_symbols); i++) {
if (!strcmp(maybe_atom->string, reserved_symbols[i])) { if (!strcmp(maybe_atom->string, reserved_symbols[i])) {
return NULL; return NULL;
} }