1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed compatibility with GCC 4.8

This commit is contained in:
Tom Poole 2018-12-06 09:51:31 +00:00
parent ec46ad4891
commit d06a2b8c13
6 changed files with 85 additions and 44 deletions

View file

@ -32,7 +32,7 @@ For further help getting started, please refer to the JUCE
#### Building JUCE Projects
- __macOS__: macOS 10.11 and Xcode 7.3.1
- __Windows__: Windows 8.1 and Visual Studio 2013 64-bit
- __Linux__: GCC 5.0
- __Linux__: GCC 4.8
#### Minimum Deployment Targets
- __macOS__: macOS 10.7

View file

@ -46,10 +46,12 @@ public:
auto content = pbxprojs[0].loadFileAsString().toStdString();
std::regex comments ("/\\*.*?\\*/");
content = (std::regex_replace (content, comments, ""));
std::string empty ("");
content = (std::regex_replace (content, comments, empty));
std::regex whitespace ("\\s+");
content = (std::regex_replace (content, whitespace, " "));
std::string space (" ");
content = (std::regex_replace (content, whitespace, space));
auto objects = std::make_unique<HashMap<std::string, std::string>>();
std::smatch objectsStartMatch;

View file

@ -104,6 +104,13 @@ class ArrayBaseTests : public UnitTest
using CopyableType = ArrayBaseTestsHelpers::TriviallyCopyableType;
using NoncopyableType = ArrayBaseTestsHelpers::NonTriviallyCopyableType;
#if ! (defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__))
static_assert (std::is_trivially_copyable<CopyableType>::value,
"Test TriviallyCopyableType is not trivially copyable");
static_assert (! std::is_trivially_copyable<NoncopyableType>::value,
"Test NonTriviallyCopyableType is trivially copyable");
#endif
public:
ArrayBaseTests()
: UnitTest ("ArrayBase", "Containers")
@ -111,11 +118,6 @@ public:
void runTest() override
{
static_assert (std::is_trivially_copyable<CopyableType>::value,
"Test TriviallyCopyableType is not trivially copyable");
static_assert (! std::is_trivially_copyable<NoncopyableType>::value,
"Test NonTriviallyCopyableType is trivially copyable");
beginTest ("grow capacity");
{
std::vector<CopyableType> referenceContainer;

View file

@ -372,10 +372,17 @@ public:
private:
//==============================================================================
template <typename T>
using TriviallyCopyableVoid = typename std::enable_if<std::is_trivially_copyable<T>::value, void>::type;
#if defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__)
using IsTriviallyCopyable = std::is_scalar<T>;
#else
using IsTriviallyCopyable = std::is_trivially_copyable<T>;
#endif
template <typename T>
using NonTriviallyCopyableVoid = typename std::enable_if<! std::is_trivially_copyable<T>::value, void>::type;
using TriviallyCopyableVoid = typename std::enable_if<IsTriviallyCopyable<T>::value, void>::type;
template <typename T>
using NonTriviallyCopyableVoid = typename std::enable_if<! IsTriviallyCopyable<T>::value, void>::type;
//==============================================================================
template <typename T = ElementType>

View file

@ -181,10 +181,7 @@ namespace TimeHelpers
}
//==============================================================================
Time::Time (int64 ms) noexcept : millisSinceEpoch (ms)
{
static_assert (std::is_trivially_copyable<Time>::value, "Time is not trivially copyable");
}
Time::Time (int64 ms) noexcept : millisSinceEpoch (ms) {}
Time::Time (int year, int month, int day,
int hours, int minutes, int seconds, int milliseconds,

View file

@ -65,9 +65,42 @@ public:
}
}
// g++ 4.8 cannot deduce the parameter pack inside the function pointer when it has more than one element
#if defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__)
template <typename... Params>
static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker,
void (MouseListener::*eventMethod) (Params...), Params... params)
void (MouseListener::*eventMethod) (const MouseEvent&),
Params... params)
{
sendMouseEvent <decltype (eventMethod), Params...> (comp, checker, eventMethod, params...);
}
template <typename... Params>
static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker,
void (MouseListener::*eventMethod) (const MouseEvent&, const MouseWheelDetails&),
Params... params)
{
sendMouseEvent <decltype (eventMethod), Params...> (comp, checker, eventMethod, params...);
}
template <typename... Params>
static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker,
void (MouseListener::*eventMethod) (const MouseEvent&, float),
Params... params)
{
sendMouseEvent <decltype (eventMethod), Params...> (comp, checker, eventMethod, params...);
}
template <typename EventMethod, typename... Params>
static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker,
EventMethod eventMethod,
Params... params)
#else
template <typename... Params>
static void sendMouseEvent (Component& comp, Component::BailOutChecker& checker,
void (MouseListener::*eventMethod) (Params...),
Params... params)
#endif
{
if (checker.shouldBailOut())
return;