Build with clang (& fix stuff so it compiles with clang
This commit is contained in:
parent
db73d0bd2e
commit
41795425d0
6 changed files with 28 additions and 2 deletions
9
build_clang.bat
Normal file
9
build_clang.bat
Normal file
|
@ -0,0 +1,9 @@
|
|||
@echo off
|
||||
rmdir /S /Q build
|
||||
mkdir build
|
||||
|
||||
pushd build
|
||||
|
||||
clang -g -o cgame.exe ../build.c -O0 -DDEBUG -std=c11 -Wextra -Wno-incompatible-library-redeclaration -Wno-sign-compare -Wno-unused-parameter
|
||||
|
||||
popd
|
13
build_release_clang.bat
Normal file
13
build_release_clang.bat
Normal file
|
@ -0,0 +1,13 @@
|
|||
@echo off
|
||||
rmdir /S /Q build
|
||||
mkdir build
|
||||
|
||||
pushd build
|
||||
|
||||
mkdir release
|
||||
pushd release
|
||||
|
||||
clang -o cgame.exe ../../build.c -O3 -DRELEASE -std=c11 -Wextra -Wno-incompatible-library-redeclaration -Wno-sign-compare -Wno-unused-parameter
|
||||
|
||||
popd
|
||||
popd
|
2
main.c
2
main.c
|
@ -20,6 +20,7 @@ int oogabooga_main(int argc, char **argv) {
|
|||
|
||||
// or we can just do this for temporary allocation
|
||||
int *b = talloc(sizeof(int));
|
||||
(void)b;
|
||||
|
||||
// Call each frame
|
||||
reset_temporary_storage();
|
||||
|
@ -39,6 +40,7 @@ int oogabooga_main(int argc, char **argv) {
|
|||
|
||||
int hello;
|
||||
hello = 5;
|
||||
(void)hello;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Hello, balls! (debug)\n");
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef struct {
|
|||
Heap_Block *heap_head;
|
||||
bool heap_initted = false;
|
||||
Spinlock *heap_lock; // This is terrible but I don't care for now
|
||||
|
||||
|
||||
|
||||
u64 get_heap_block_size_excluding_metadata(Heap_Block *block) {
|
||||
return block->size - sizeof(Heap_Block);
|
||||
|
|
|
@ -122,7 +122,7 @@ typedef struct Thread {
|
|||
|
||||
///
|
||||
// Thread primitive
|
||||
Thread* os_make_thread();
|
||||
Thread* os_make_thread(Thread_Proc proc);
|
||||
void os_start_thread(Thread* t);
|
||||
void os_join_thread(Thread* t);
|
||||
|
||||
|
|
|
@ -106,7 +106,9 @@ void test_allocator(bool do_log_heap) {
|
|||
int* foo = (int*)alloc(72);
|
||||
*foo = 1337;
|
||||
void* bar = alloc(69);
|
||||
(void)bar;
|
||||
void* baz = alloc(420);
|
||||
(void)baz;
|
||||
|
||||
assert(*foo == 1337, "Temp memory corruptada");
|
||||
|
||||
|
|
Reference in a new issue