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

Convert ignoreUnused to [[maybe_unused]]

This commit is contained in:
reuk 2022-09-16 19:08:31 +01:00
parent 4351e87bdd
commit 28f2157912
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
141 changed files with 1057 additions and 1209 deletions

View file

@ -70,10 +70,9 @@ namespace detail
template <typename Fn>
void clear (void* s)
{
auto& fn = *reinterpret_cast<Fn*> (s);
fn.~Fn();
// I know this looks insane, for some reason MSVC 14 sometimes thinks fn is unreferenced
ignoreUnused (fn);
[[maybe_unused]] auto& fn = *reinterpret_cast<Fn*> (s);
fn.~Fn();
}
template <typename Fn, typename Ret, typename... Args>

View file

@ -334,8 +334,8 @@ public:
bool smallCalled = false;
bool largeCalled = false;
SmallFn small = [&smallCalled, a = std::array<char, 8>{}] { smallCalled = true; juce::ignoreUnused (a); };
LargeFn large = [&largeCalled, a = std::array<char, 8>{}] { largeCalled = true; juce::ignoreUnused (a); };
SmallFn small = [&smallCalled, a = std::array<char, 8>{}] { smallCalled = true; ignoreUnused (a); };
LargeFn large = [&largeCalled, a = std::array<char, 8>{}] { largeCalled = true; ignoreUnused (a); };
large = std::move (small);

View file

@ -208,10 +208,10 @@ namespace juce
inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
#endif
#else
inline void snapToZero (float& x) noexcept { ignoreUnused (x); }
inline void snapToZero ([[maybe_unused]] float& x) noexcept {}
#ifndef DOXYGEN
inline void snapToZero (double& x) noexcept { ignoreUnused (x); }
inline void snapToZero (long double& x) noexcept { ignoreUnused (x); }
inline void snapToZero ([[maybe_unused]] double& x) noexcept {}
inline void snapToZero ([[maybe_unused]] long double& x) noexcept {}
#endif
#endif
}