mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows: Fixed various compiler warnings and errors when building JUCE with MSVC's latest C++ 2017 support
This commit is contained in:
parent
f1a8e8f610
commit
2f2ff9437b
17 changed files with 30 additions and 101 deletions
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include "b2ChainShape.h"
|
||||
#include "b2EdgeShape.h"
|
||||
#include <new>
|
||||
#include <cstring>
|
||||
|
||||
using namespace std;
|
||||
|
||||
b2ChainShape::~b2ChainShape()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "b2CircleShape.h"
|
||||
#include <new>
|
||||
|
||||
using namespace std;
|
||||
|
||||
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "b2EdgeShape.h"
|
||||
#include <new>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "b2PolygonShape.h"
|
||||
#include <new>
|
||||
|
||||
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "b2BroadPhase.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace std;
|
||||
|
||||
b2BroadPhase::b2BroadPhase()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#define B2_COLLISION_H
|
||||
|
||||
#include "../Common/b2Math.h"
|
||||
#include <climits>
|
||||
|
||||
/// @file
|
||||
/// Structures and functions used for computing contact points, distance
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "b2BlockAllocator.h"
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] =
|
||||
|
|
|
|||
|
|
@ -21,11 +21,6 @@
|
|||
|
||||
#include "b2Settings.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
/// This function is used to ensure that a floating point number is
|
||||
/// not a NaN or infinity.
|
||||
inline bool b2IsValid(float32 x)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "b2Settings.h"
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
|
||||
b2Version b2_version = {2, 2, 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,8 @@
|
|||
#ifndef B2_SETTINGS_H
|
||||
#define B2_SETTINGS_H
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#define B2_NOT_USED(x) ((void)(x))
|
||||
#define b2Assert(A) assert(A)
|
||||
#define b2Assert(A) jassert(A)
|
||||
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
|
|
|
|||
|
|
@ -18,83 +18,17 @@
|
|||
|
||||
#include "b2Timer.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
float64 b2Timer::s_invFrequency = 0.0f;
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
|
||||
if (s_invFrequency == 0.0f)
|
||||
{
|
||||
QueryPerformanceFrequency(&largeInteger);
|
||||
s_invFrequency = float64(largeInteger.QuadPart);
|
||||
if (s_invFrequency > 0.0f)
|
||||
{
|
||||
s_invFrequency = 1000.0f / s_invFrequency;
|
||||
}
|
||||
}
|
||||
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
m_start = float64(largeInteger.QuadPart);
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
m_start = float64(largeInteger.QuadPart);
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
float64 count = float64(largeInteger.QuadPart);
|
||||
float32 ms = float32(s_invFrequency * (count - m_start));
|
||||
return ms;
|
||||
}
|
||||
|
||||
#elif defined(__linux__) || defined (__APPLE__)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
b2Timer::b2Timer()
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
timeval t;
|
||||
gettimeofday(&t, 0);
|
||||
m_start_sec = t.tv_sec;
|
||||
m_start_msec = t.tv_usec * 0.001f;
|
||||
juceStartTime = juce::Time::getCurrentTime();
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
timeval t;
|
||||
gettimeofday(&t, 0);
|
||||
return (t.tv_sec - m_start_sec) * 1000 + t.tv_usec * 0.001f - m_start_msec;
|
||||
return static_cast<float32> ((juce::Time::getCurrentTime() - juceStartTime).inMilliseconds());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,14 +37,7 @@ public:
|
|||
float32 GetMilliseconds() const;
|
||||
|
||||
private:
|
||||
|
||||
#if defined(_WIN32)
|
||||
float64 m_start;
|
||||
static float64 s_invFrequency;
|
||||
#elif defined(__linux__) || defined (__APPLE__)
|
||||
unsigned long m_start_sec;
|
||||
unsigned long m_start_msec;
|
||||
#endif
|
||||
juce::Time juceStartTime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "../Common/b2Math.h"
|
||||
#include "../Collision/Shapes/b2Shape.h"
|
||||
#include <memory>
|
||||
|
||||
class b2Fixture;
|
||||
class b2Joint;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "juce_box2d.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
typedef juce::int8 int8;
|
||||
typedef juce::int16 int16;
|
||||
typedef juce::int32 int32;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@
|
|||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
#include <cfloat>
|
||||
|
||||
#include "box2d/Box2D.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@
|
|||
#define JUCE_EXCEPTIONS_DISABLED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L)
|
||||
#define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L)
|
||||
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -79,6 +83,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L)
|
||||
#define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L)
|
||||
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -106,6 +113,9 @@
|
|||
#define JUCE_EXCEPTIONS_DISABLED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define JUCE_CXX14_IS_AVAILABLE (_MSVC_LANG >= 201402L)
|
||||
#define JUCE_CXX17_IS_AVAILABLE (_MSVC_LANG >= 201703L)
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -72,8 +72,13 @@ struct WaveShaper
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_CXX17_IS_AVAILABLE
|
||||
template <typename Functor>
|
||||
static WaveShaper<typename std::invoke_result<Functor>, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; }
|
||||
#else
|
||||
template <typename Functor>
|
||||
static WaveShaper<typename std::result_of<Functor>, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; }
|
||||
#endif
|
||||
|
||||
} // namespace dsp
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue