Fix compile and warnings on MSVC

This commit is contained in:
Doyle Thai 2017-06-21 19:01:36 +10:00
parent a067fed81f
commit 93bbc25b11
4 changed files with 32 additions and 12 deletions

29
dqn.h
View File

@ -1480,7 +1480,6 @@ STBSP__PUBLICDEF void STB_SPRINTF_DECORATE(set_separators)(char comma, char peri
#include <math.h> // TODO(doyle): For trigonometry functions (for now)
#include <stdlib.h> // For calloc, malloc, free
#include <stdio.h> // For printf
#include <x86intrin.h> // __rdtsc
// NOTE: STB_SPRINTF is included when DQN_IMPLEMENTATION defined
// #define STB_SPRINTF_IMPLEMENTATION
@ -3488,6 +3487,10 @@ FILE_SCOPE u64 DqnRnd_Murmur3Avalanche64Internal(u64 h)
return h;
}
#if defined(DQN_UNIX_PLATFORM)
#include <x86intrin.h> // __rdtsc
#endif
FILE_SCOPE u32 DqnRnd_MakeSeedInternal()
{
#if defined(DQN_WIN32_PLATFORM) || defined(DQN_UNIX_PLATFORM)
@ -4034,8 +4037,11 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC):
"...512 char string..." ( 35.0x/32.5x faster!)
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#endif
#include <stdlib.h> // for va_arg()
#define stbsp__uint32 unsigned int
@ -5016,14 +5022,20 @@ static stbsp__int32 stbsp__real_to_str( char const * * start, stbsp__uint32 * le
#undef stbsp__uint64
#undef stbsp__int64
#undef STBSP__UNALIGNED
#pragma GCC diagnostic pop
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
////////////////////////////////////////////////////////////////////////////////
// ini.h v1.1 | IMPLEMENTATION
// Simple ini-file reader for C/C++.
////////////////////////////////////////////////////////////////////////////////
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif
#define INITIAL_CAPACITY (256)
#define _CRT_NONSTDC_NO_DEPRECATE
@ -5659,7 +5671,10 @@ void DqnIni_PropertyValueSet(DqnIni *ini, int section, int property,
}
}
}
#pragma GCC diagnostic pop // -Wsign-compare for DQN_INI
#ifdef __GNUC__
#pragma GCC diagnostic pop // -Wsign-compare for DQN_INI
#endif
#endif // DQN_IMPLEMENTATION
////////////////////////////////////////////////////////////////////////////////

View File

@ -1528,7 +1528,7 @@ FILE_SCOPE void JobQueueTest()
const i32 QUEUE_SIZE = 256;
DqnJobQueue_InitWithMem(NULL, &requiredSize, QUEUE_SIZE, 0);
DqnMemStack memStack;
DqnMemStack memStack = {};
DQN_ASSERT_HARD(DqnMemStack_Init(&memStack, requiredSize, true));
i32 numThreads, numCores;

View File

@ -21,7 +21,7 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87785192-6F49-4F85-AA0D-F0AFA5CCCDDA}.Release|x86.ActiveCfg = Release|x64
{87785192-6F49-4F85-AA0D-F0AFA5CCCDDA}.Release|x86.ActiveCfg = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,5 +1,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpsabi"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpsabi"
#endif
/*
HandmadeMath.h v1.1.2
@ -2659,4 +2661,7 @@ operator*=(hmm_quaternion &Left, float Right)
#endif /* HANDMADE_MATH_CPP_MODE */
#endif /* HANDMADE_MATH_IMPLEMENTATION */
#pragma GCC diagnostic pop
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif