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
|
// or we can just do this for temporary allocation
|
||||||
int *b = talloc(sizeof(int));
|
int *b = talloc(sizeof(int));
|
||||||
|
(void)b;
|
||||||
|
|
||||||
// Call each frame
|
// Call each frame
|
||||||
reset_temporary_storage();
|
reset_temporary_storage();
|
||||||
|
@ -39,6 +40,7 @@ int oogabooga_main(int argc, char **argv) {
|
||||||
|
|
||||||
int hello;
|
int hello;
|
||||||
hello = 5;
|
hello = 5;
|
||||||
|
(void)hello;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Hello, balls! (debug)\n");
|
printf("Hello, balls! (debug)\n");
|
||||||
|
|
|
@ -122,7 +122,7 @@ typedef struct Thread {
|
||||||
|
|
||||||
///
|
///
|
||||||
// Thread primitive
|
// Thread primitive
|
||||||
Thread* os_make_thread();
|
Thread* os_make_thread(Thread_Proc proc);
|
||||||
void os_start_thread(Thread* t);
|
void os_start_thread(Thread* t);
|
||||||
void os_join_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);
|
int* foo = (int*)alloc(72);
|
||||||
*foo = 1337;
|
*foo = 1337;
|
||||||
void* bar = alloc(69);
|
void* bar = alloc(69);
|
||||||
|
(void)bar;
|
||||||
void* baz = alloc(420);
|
void* baz = alloc(420);
|
||||||
|
(void)baz;
|
||||||
|
|
||||||
assert(*foo == 1337, "Temp memory corruptada");
|
assert(*foo == 1337, "Temp memory corruptada");
|
||||||
|
|
||||||
|
|
Reference in a new issue