mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Remove VS2015 workarounds
This commit is contained in:
parent
2fdc4f6633
commit
f582c84c37
4 changed files with 41 additions and 62 deletions
|
|
@ -23,53 +23,6 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN
|
||||
/** The contents of this namespace are used to implement AudioBuffer and should
|
||||
not be used elsewhere. Their interfaces (and existence) are liable to change!
|
||||
*/
|
||||
namespace detail
|
||||
{
|
||||
/** On iOS/arm7 the alignment of `double` is greater than the alignment of
|
||||
`std::max_align_t`, so we can't trust max_align_t. Instead, we query
|
||||
lots of primitive types and use the maximum alignment of all of them.
|
||||
|
||||
We're putting this stuff outside AudioBuffer itself to avoid creating
|
||||
unnecessary copies for each distinct template instantiation of
|
||||
AudioBuffer.
|
||||
|
||||
MSVC 2015 doesn't like when we write getMaxAlignment as a loop which
|
||||
accumulates the max alignment (declarations not allowed in constexpr
|
||||
function body) so instead we use this recursive version which
|
||||
instantiates a zillion templates.
|
||||
*/
|
||||
|
||||
template <typename> struct Type {};
|
||||
|
||||
constexpr size_t getMaxAlignment() noexcept { return 0; }
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
constexpr size_t getMaxAlignment (Type<Head>, Type<Tail>... tail) noexcept
|
||||
{
|
||||
return jmax (alignof (Head), getMaxAlignment (tail...));
|
||||
}
|
||||
|
||||
constexpr size_t maxAlignment = getMaxAlignment (Type<std::max_align_t>{},
|
||||
Type<void*>{},
|
||||
Type<float>{},
|
||||
Type<double>{},
|
||||
Type<long double>{},
|
||||
Type<short int>{},
|
||||
Type<int>{},
|
||||
Type<long int>{},
|
||||
Type<long long int>{},
|
||||
Type<bool>{},
|
||||
Type<char>{},
|
||||
Type<char16_t>{},
|
||||
Type<char32_t>{},
|
||||
Type<wchar_t>{});
|
||||
} // namespace detail
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A multi-channel buffer containing floating point audio samples.
|
||||
|
|
@ -1215,17 +1168,10 @@ public:
|
|||
|
||||
private:
|
||||
//==============================================================================
|
||||
int numChannels = 0, size = 0;
|
||||
size_t allocatedBytes = 0;
|
||||
Type** channels;
|
||||
HeapBlock<char, true> allocatedData;
|
||||
Type* preallocatedChannelSpace[32];
|
||||
bool isClear = false;
|
||||
|
||||
void allocateData()
|
||||
{
|
||||
#if (! JUCE_GCC || (__GNUC__ * 100 + __GNUC_MINOR__) >= 409)
|
||||
static_assert (alignof (Type) <= detail::maxAlignment,
|
||||
static_assert (alignof (Type) <= maxAlignment,
|
||||
"AudioBuffer cannot hold types with alignment requirements larger than that guaranteed by malloc");
|
||||
#endif
|
||||
jassert (size >= 0);
|
||||
|
|
@ -1278,6 +1224,43 @@ private:
|
|||
isClear = false;
|
||||
}
|
||||
|
||||
/* On iOS/arm7 the alignment of `double` is greater than the alignment of
|
||||
`std::max_align_t`, so we can't trust max_align_t. Instead, we query
|
||||
lots of primitive types and use the maximum alignment of all of them.
|
||||
*/
|
||||
static constexpr size_t getMaxAlignment() noexcept
|
||||
{
|
||||
constexpr size_t alignments[] { alignof (std::max_align_t),
|
||||
alignof (void*),
|
||||
alignof (float),
|
||||
alignof (double),
|
||||
alignof (long double),
|
||||
alignof (short int),
|
||||
alignof (int),
|
||||
alignof (long int),
|
||||
alignof (long long int),
|
||||
alignof (bool),
|
||||
alignof (char),
|
||||
alignof (char16_t),
|
||||
alignof (char32_t),
|
||||
alignof (wchar_t) };
|
||||
|
||||
size_t max = 0;
|
||||
|
||||
for (const auto elem : alignments)
|
||||
max = jmax (max, elem);
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
int numChannels = 0, size = 0;
|
||||
size_t allocatedBytes = 0;
|
||||
Type** channels;
|
||||
HeapBlock<char, true> allocatedData;
|
||||
Type* preallocatedChannelSpace[32];
|
||||
bool isClear = false;
|
||||
static constexpr size_t maxAlignment = getMaxAlignment();
|
||||
|
||||
JUCE_LEAK_DETECTOR (AudioBuffer)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ void BufferingAudioSource::releaseResources()
|
|||
|
||||
buffer.setSize (numberOfChannels, 0);
|
||||
|
||||
// MSVC2015 seems to need this if statement to not generate a warning during linking.
|
||||
// MSVC2017 seems to need this if statement to not generate a warning during linking.
|
||||
// As source is set in the constructor, there is no way that source could
|
||||
// ever equal this, but it seems to make MSVC2015 happy.
|
||||
// ever equal this, but it seems to make MSVC2017 happy.
|
||||
if (source != this)
|
||||
source->releaseResources();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
#ifndef JUCE_VECTOR_CALLTYPE
|
||||
// __vectorcall does not work on 64-bit due to internal compiler error in
|
||||
// release mode in both VS2015 and VS2017. Re-enable when Microsoft fixes this
|
||||
// release mode VS2017. Re-enable when Microsoft fixes this
|
||||
#if _MSC_VER && JUCE_USE_SIMD && ! (defined(_M_X64) || defined(__amd64__))
|
||||
#define JUCE_VECTOR_CALLTYPE __vectorcall
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -411,12 +411,8 @@ ColourSelector::ColourSelector (int sectionsToShow, int edge, int gapAroundColou
|
|||
|
||||
sliders[3]->setVisible ((flags & showAlphaChannel) != 0);
|
||||
|
||||
// VS2015 needs some scoping braces around this if statement to
|
||||
// avoid a compiler bug.
|
||||
for (auto& slider : sliders)
|
||||
{
|
||||
slider->onValueChange = [this] { changeColour(); };
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & showColourspace) != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue