In order to compile Handmade Hero on Linux and OS X there are some issues that needs to be fixed. I am looking for volunteers to bring these issues to Casey's attention during the stream.
GCC and Clang seems unhappy with casting a pointer directly to a 16 or 32 bit number.
"cast from pointer to smaller type 'u32' (aka 'unsigned int') loses information".
This needs to be addressed in three places:
ParseMember in simple_preprocessor.cpp
| printf(" {%s, MetaType_%.*s, \"%.*s\", (u32)&((%.*s *)0)->%.*s},\n",
|
GetOrCreateDebugViewFor in handmade_debug.cpp
| u32 HashIndex = (((u32)ID.Value[0] >> 2) + ((u32)ID.Value[1] >> 2)) % ArrayCount(DebugState->ViewHash);
|
CollateDebugRecords in handmade_debug.cpp
| Region->ColorIndex = (u16)OpeningEvent→BlockName;
|
This issue can be solved by casting to memory_index aka size_t before casting to u32/u16.
There is some leftover copy/pasta in handmade_platform.h.
"extra tokens at end of #endif directive"
There is an empty method in handmade_debug.cpp.
"control reaches end of non-void function"
| inline rectangle2
PlaceRectangle(layout *Layout, v2 Dim)
{
}
|
_snprintf_s is not supported and needs to be replaced. This will be solved once the dependency to stdio is removed which Casey hopefully will do soon.
/Kim