Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
- Wrap `linalloc' macro replacement list with parentheses.
- Remove arena tests that are caught by `alloc_align' attribute.
- Add returns to test main.
- Add -fpie to test executables.
  • Loading branch information
gitrj95 committed Mar 16, 2024
1 parent d0436ac commit 412c285
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <stddef.h>

#define linalloc(a, T) (T *)linalloc_explicit((a), sizeof(T), alignof(T))
#define linalloc(a, T) ((T *)linalloc_explicit((a), sizeof(T), alignof(T)))

typedef struct {
void *hd, *tl;
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DELIM = echo "~~"
ASAN = -fsanitize=address
UBSAN = -fsanitize=undefined
TSAN = -fsanitize=thread
CFLAGS = -std=$(STD) -Wall -Wextra -Wconversion -Wno-sign-conversion -Wdouble-promotion -Wcast-qual -Wvla -Werror -pedantic -O0 -g3 -DNCOLOR=$(NCOLOR)
CFLAGS = -std=$(STD) -Wall -Wextra -Wconversion -Wno-sign-conversion -Wdouble-promotion -Wcast-qual -Wvla -Werror -pedantic -O0 -g3 -DNCOLOR=$(NCOLOR) -fpie
LDFLAGS = -Wl,-pie

check: test_arena test_spinlock test_msi
Expand Down
4 changes: 1 addition & 3 deletions test/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ void alloc(void) {
f = linalloc_explicit(&a, sizeof(*f), (uint16_t)1 << 4);
f = linalloc(&a, float);
*f = 1000.f;
die(linalloc_explicit(&a, 0, 0), "zeroed item size");
die(linalloc_explicit(&a, 10, -1), "negative alignment");
die(linalloc_explicit(&a, 10, 123), "alignment not a power-of-2");
die(arena_delete(&a, -1, 0), "negative length");
arena_delete(&a, pagesz + 123, 0);
}
Expand All @@ -91,4 +88,5 @@ int main(void) {
initndelete();
alloc();
hijack_alloc();
return 0;
}
1 change: 1 addition & 0 deletions test/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ int main(void) {
suite();
init();
walk();
return 0;
}
1 change: 1 addition & 0 deletions test/spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ void sum(void) {
int main(void) {
suite();
sum();
return 0;
}

0 comments on commit 412c285

Please sign in to comment.