Fix crashes on unix using gcc -O3
This commit is contained in:
parent
2d163fa554
commit
f8a4d4fe4b
@ -31,7 +31,7 @@ REM Zi enables debug data, Z7 combines the debug files into one.
|
|||||||
REM W4 warning level 4
|
REM W4 warning level 4
|
||||||
REM WX treat warnings as errors
|
REM WX treat warnings as errors
|
||||||
REM wd4201 ignore: nonstandard extension used: nameless struct/union
|
REM wd4201 ignore: nonstandard extension used: nameless struct/union
|
||||||
set CompileFlags=-EHsc -GR- -Oi -MT -Z7 -W4 -WX -wd4201 -FC -Od
|
set CompileFlags=-EHsc -GR- -Oi -MT -Z7 -W4 -WX -wd4201 -FC -O2 -wd4127
|
||||||
|
|
||||||
REM Include directories
|
REM Include directories
|
||||||
set IncludeFlags=
|
set IncludeFlags=
|
||||||
|
2
dqn.h
2
dqn.h
@ -6336,7 +6336,6 @@ DQN_FILE_SCOPE void DqnFile_Close(DqnFile *const file)
|
|||||||
|
|
||||||
#if defined(DQN_WIN32_PLATFORM)
|
#if defined(DQN_WIN32_PLATFORM)
|
||||||
DQN_COMPILE_ASSERT(sizeof(DWORD) == sizeof(u32));
|
DQN_COMPILE_ASSERT(sizeof(DWORD) == sizeof(u32));
|
||||||
DQN_COMPILE_ASSERT(sizeof(size_t) >= sizeof(u64));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DQN_FILE_SCOPE bool DqnFile_GetFileSizeW(const wchar_t *const path, size_t *const size)
|
DQN_FILE_SCOPE bool DqnFile_GetFileSizeW(const wchar_t *const path, size_t *const size)
|
||||||
@ -6346,6 +6345,7 @@ DQN_FILE_SCOPE bool DqnFile_GetFileSizeW(const wchar_t *const path, size_t *cons
|
|||||||
WIN32_FILE_ATTRIBUTE_DATA attribData = {};
|
WIN32_FILE_ATTRIBUTE_DATA attribData = {};
|
||||||
if (GetFileAttributesExW(path, GetFileExInfoStandard, &attribData))
|
if (GetFileAttributesExW(path, GetFileExInfoStandard, &attribData))
|
||||||
{
|
{
|
||||||
|
// TODO(doyle): What if size_t is < Quad.part?
|
||||||
LARGE_INTEGER largeInt = {};
|
LARGE_INTEGER largeInt = {};
|
||||||
largeInt.HighPart = attribData.nFileSizeHigh;
|
largeInt.HighPart = attribData.nFileSizeHigh;
|
||||||
largeInt.LowPart = attribData.nFileSizeLow;
|
largeInt.LowPart = attribData.nFileSizeLow;
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
#define HANDMADE_MATH_NO_SSE
|
#define HANDMADE_MATH_NO_SSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DQN_IMPLEMENTATION
|
#define DQN_IMPLEMENTATION
|
||||||
#include "dqn.h"
|
#include "dqn.h"
|
||||||
|
|
||||||
@ -341,9 +346,12 @@ void StringsTest()
|
|||||||
DQN_ASSERT(DqnStr_Cmp(d, "18446744073709551615") == 0);
|
DQN_ASSERT(DqnStr_Cmp(d, "18446744073709551615") == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (sizeof(size_t) == sizeof(u64))
|
||||||
|
{
|
||||||
char e[DQN_64BIT_NUM_MAX_STR_SIZE] = {};
|
char e[DQN_64BIT_NUM_MAX_STR_SIZE] = {};
|
||||||
Dqn_I64ToStr(SMALLEST_NUM, e, DQN_ARRAY_COUNT(e));
|
Dqn_I64ToStr(SMALLEST_NUM, e, DQN_ARRAY_COUNT(e));
|
||||||
DQN_ASSERT_MSG(DqnStr_Cmp(e, "-9223372036854775808") == 0, "e: %s", e);
|
DQN_ASSERT_MSG(DqnStr_Cmp(e, "-9223372036854775808") == 0, "e: %s", e);
|
||||||
|
}
|
||||||
|
|
||||||
printf("StringsTest(): I64ToStr: Completed successfully\n");
|
printf("StringsTest(): I64ToStr: Completed successfully\n");
|
||||||
}
|
}
|
||||||
@ -1963,3 +1971,7 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user