enable readability-else-after-return tidy check

This commit is contained in:
Daniel Micay 2018-11-16 15:12:10 -05:00
parent 58c7079db9
commit 06149aa156
2 changed files with 8 additions and 4 deletions

View File

@ -21,7 +21,7 @@ endif
CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes
CXXFLAGS := -std=c++14 $(SHARED_FLAGS)
LDFLAGS := -Wl,--as-needed,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text
TIDY_CHECKS := -checks=bugprone-*,-bugprone-macro-parentheses,cert-*,clang-analyzer-*,readability-*,-readability-else-after-return,-readability-inconsistent-declaration-parameter-name,-readability-named-parameter
TIDY_CHECKS := -checks=bugprone-*,-bugprone-macro-parentheses,cert-*,clang-analyzer-*,readability-*,-readability-inconsistent-declaration-parameter-name,-readability-named-parameter
SOURCES := chacha.c malloc.c memory.c pages.c random.c util.c
OBJECTS := $(SOURCES:.c=.o)

View File

@ -344,10 +344,12 @@ static bool has_free_slots(size_t slots, struct slab_metadata *metadata) {
if (slots <= 64) {
u64 masked = metadata->bitmap[0] | get_mask(slots);
return masked != ~0UL;
} else if (slots <= 128) {
}
if (slots <= 128) {
u64 masked = metadata->bitmap[1] | get_mask(slots - 64);
return metadata->bitmap[0] != ~0UL || masked != ~0UL;
} else if (slots <= 192) {
}
if (slots <= 192) {
u64 masked = metadata->bitmap[2] | get_mask(slots - 128);
return metadata->bitmap[0] != ~0UL || metadata->bitmap[1] != ~0UL || masked != ~0UL;
}
@ -434,7 +436,9 @@ static inline void *allocate_small(size_t requested_size) {
mutex_unlock(&c->lock);
return p;
} else if (c->free_slabs_head != NULL) {
}
if (c->free_slabs_head != NULL) {
struct slab_metadata *metadata = c->free_slabs_head;
metadata->canary_value = get_random_canary(&c->rng);