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

Fixed some gcc 8 compiler warnings

This commit is contained in:
Tom Poole 2018-07-10 17:41:26 +01:00
parent 08d67c763f
commit 6cff481c6a
9 changed files with 46 additions and 43 deletions

View file

@ -289,7 +289,7 @@ void HeaderComponent::initialiseButtons() noexcept
{ {
sendProjectButtonAnalyticsEvent ("User Settings"); sendProjectButtonAnalyticsEvent ("User Settings");
if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) if (findParentComponentOfClass<ProjectContentComponent>() != nullptr)
showUserSettings(); showUserSettings();
}; };

View file

@ -1961,8 +1961,8 @@ private:
{ {
const uint8 n0 = si.allocation[i][0]; const uint8 n0 = si.allocation[i][0];
const uint8 n1 = si.allocation[i][1]; const uint8 n1 = si.allocation[i][1];
fraction[0][i] = n0 > 0 ? (float) (((-1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0; fraction[0][i] = n0 > 0 ? (float) ((-(1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0;
fraction[1][i] = n1 > 0 ? (float) (((-1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0; fraction[1][i] = n1 > 0 ? (float) ((-(1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0;
} }
for (i = jsbound; i < 32; ++i) for (i = jsbound; i < 32; ++i)
@ -1971,7 +1971,7 @@ private:
if (n > 0) if (n > 0)
{ {
const uint32 w = ((uint32) (-1 << n) + getBitsUint16 (n + 1) + 1); const uint32 w = ((uint32) -(1 << n) + getBitsUint16 (n + 1) + 1);
fraction[0][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][0]]); fraction[0][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][0]]);
fraction[1][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][1]]); fraction[1][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][1]]);
} }
@ -1987,7 +1987,7 @@ private:
const uint8 j = si.scaleFactor[i][0]; const uint8 j = si.scaleFactor[i][0];
if (n > 0) if (n > 0)
fraction[0][i] = (float) (((-1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]); fraction[0][i] = (float) ((-(1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]);
else else
fraction[0][i] = 0; fraction[0][i] = 0;
} }

View file

@ -516,7 +516,7 @@ private:
if (useLog && low > 0 && high > 0) if (useLog && low > 0 && high > 0)
return expf (logf (low) * (1.0f - alpha) + logf (high) * alpha); return expf (logf (low) * (1.0f - alpha) + logf (high) * alpha);
return low + (high - low) * alpha; return low + (high - low) * alpha;
} }
static float toIntIfNecessary (const LADSPA_PortRangeHintDescriptor& desc, float value) static float toIntIfNecessary (const LADSPA_PortRangeHintDescriptor& desc, float value)

View file

@ -29,7 +29,7 @@ b2DynamicTree::b2DynamicTree()
m_nodeCapacity = 16; m_nodeCapacity = 16;
m_nodeCount = 0; m_nodeCount = 0;
m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode));
memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode)); memset((void*)m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode));
// Build a linked list for the free list. // Build a linked list for the free list.
for (int32 i = 0; i < m_nodeCapacity - 1; ++i) for (int32 i = 0; i < m_nodeCapacity - 1; ++i)

View file

@ -29,7 +29,7 @@ inline void zeromem (void* memory, size_t numBytes) noexcept { memset (me
/** Overwrites a structure or object with zeros. */ /** Overwrites a structure or object with zeros. */
template <typename Type> template <typename Type>
inline void zerostruct (Type& structure) noexcept { memset (&structure, 0, sizeof (structure)); } inline void zerostruct (Type& structure) noexcept { memset ((void*) &structure, 0, sizeof (structure)); }
/** Delete an object pointer, and sets the pointer to null. /** Delete an object pointer, and sets the pointer to null.

View file

@ -66,7 +66,6 @@ void Filter<SampleType>::reset (SampleType resetToValue)
template <typename SampleType> template <typename SampleType>
void Filter<SampleType>::prepare (const ProcessSpec&) noexcept { reset(); } void Filter<SampleType>::prepare (const ProcessSpec&) noexcept { reset(); }
template <typename SampleType> template <typename SampleType>
template <typename ProcessContext, bool bypassed> template <typename ProcessContext, bool bypassed>
void Filter<SampleType>::processInternal (const ProcessContext& context) noexcept void Filter<SampleType>::processInternal (const ProcessContext& context) noexcept
@ -88,11 +87,6 @@ void Filter<SampleType>::processInternal (const ProcessContext& context) noexcep
auto* dst = outputBlock.getChannelPointer (0); auto* dst = outputBlock.getChannelPointer (0);
auto* coeffs = coefficients->getRawCoefficients(); auto* coeffs = coefficients->getRawCoefficients();
// we need to copy this template parameter into a constexpr
// otherwise MSVC will moan that the tenary expressions below
// are constant conditional expressions
constexpr bool isBypassed = bypassed;
switch (order) switch (order)
{ {
case 1: case 1:
@ -105,12 +99,12 @@ void Filter<SampleType>::processInternal (const ProcessContext& context) noexcep
for (size_t i = 0; i < numSamples; ++i) for (size_t i = 0; i < numSamples; ++i)
{ {
auto in = src[i]; auto input = src[i];
auto out = in * b0 + lv1; auto output = input * b0 + lv1;
dst[i] = isBypassed ? in : out; dst[i] = bypassed ? input : output;
lv1 = (in * b1) - (out * a1); lv1 = (input * b1) - (output * a1);
} }
util::snapToZero (lv1); state[0] = lv1; util::snapToZero (lv1); state[0] = lv1;
@ -130,12 +124,12 @@ void Filter<SampleType>::processInternal (const ProcessContext& context) noexcep
for (size_t i = 0; i < numSamples; ++i) for (size_t i = 0; i < numSamples; ++i)
{ {
auto in = src[i]; auto input = src[i];
auto out = (in * b0) + lv1; auto output = (input * b0) + lv1;
dst[i] = isBypassed ? in : out; dst[i] = bypassed ? input : output;
lv1 = (in * b1) - (out * a1) + lv2; lv1 = (input * b1) - (output* a1) + lv2;
lv2 = (in * b2) - (out * a2); lv2 = (input * b2) - (output* a2);
} }
util::snapToZero (lv1); state[0] = lv1; util::snapToZero (lv1); state[0] = lv1;
@ -159,13 +153,13 @@ void Filter<SampleType>::processInternal (const ProcessContext& context) noexcep
for (size_t i = 0; i < numSamples; ++i) for (size_t i = 0; i < numSamples; ++i)
{ {
auto in = src[i]; auto input = src[i];
auto out = (in * b0) + lv1; auto output = (input * b0) + lv1;
dst[i] = isBypassed ? in : out; dst[i] = bypassed ? input : output;
lv1 = (in * b1) - (out * a1) + lv2; lv1 = (input * b1) - (output* a1) + lv2;
lv2 = (in * b2) - (out * a2) + lv3; lv2 = (input * b2) - (output* a2) + lv3;
lv3 = (in * b3) - (out * a3); lv3 = (input * b3) - (output* a3);
} }
util::snapToZero (lv1); state[0] = lv1; util::snapToZero (lv1); state[0] = lv1;
@ -178,14 +172,14 @@ void Filter<SampleType>::processInternal (const ProcessContext& context) noexcep
{ {
for (size_t i = 0; i < numSamples; ++i) for (size_t i = 0; i < numSamples; ++i)
{ {
auto in = src[i]; auto input = src[i];
auto out = (in * coeffs[0]) + state[0]; auto output= (input * coeffs[0]) + state[0];
dst[i] = isBypassed ? in : out; dst[i] = bypassed ? input : output;
for (size_t j = 0; j < order - 1; ++j) for (size_t j = 0; j < order - 1; ++j)
state[j] = (in * coeffs[j + 1]) - (out * coeffs[order + j + 1]) + state[j + 1]; state[j] = (input * coeffs[j + 1]) - (output* coeffs[order + j + 1]) + state[j + 1];
state[order - 1] = (in * coeffs[order]) - (out * coeffs[order * 2]); state[order - 1] = (input * coeffs[order]) - (output* coeffs[order * 2]);
} }
snapToZero(); snapToZero();
@ -199,14 +193,14 @@ SampleType JUCE_VECTOR_CALLTYPE Filter<SampleType>::processSample (SampleType sa
check(); check();
auto* c = coefficients->getRawCoefficients(); auto* c = coefficients->getRawCoefficients();
auto out = (c[0] * sample) + state[0]; auto output= (c[0] * sample) + state[0];
for (size_t j = 0; j < order - 1; ++j) for (size_t j = 0; j < order - 1; ++j)
state[j] = (c[j + 1] * sample) - (c[order + j + 1] * out) + state[j + 1]; state[j] = (c[j + 1] * sample) - (c[order + j + 1] * output) + state[j + 1];
state[order - 1] = (c[order] * sample) - (c[order * 2] * out); state[order - 1] = (c[order] * sample) - (c[order * 2] * output);
return out; return output;
} }
template <typename SampleType> template <typename SampleType>

View file

@ -53,9 +53,7 @@ public:
//============================================================================== //==============================================================================
/** Creates an empty set. */ /** Creates an empty set. */
SelectedItemSet() SelectedItemSet() = default;
{
}
/** Creates a set based on an array of items. */ /** Creates a set based on an array of items. */
explicit SelectedItemSet (const ItemArray& items) explicit SelectedItemSet (const ItemArray& items)
@ -65,7 +63,7 @@ public:
/** Creates a copy of another set. */ /** Creates a copy of another set. */
SelectedItemSet (const SelectedItemSet& other) SelectedItemSet (const SelectedItemSet& other)
: selectedItems (other.selectedItems) : ChangeBroadcaster(), selectedItems (other.selectedItems)
{ {
} }

View file

@ -100,7 +100,18 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/wait.h> #include <sys/wait.h>
#if JUCE_GCC && __GNUC__ > 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wparentheses"
#endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
#if JUCE_GCC && __GNUC__ > 7
#pragma GCC diagnostic pop
#endif
#include <gtk/gtkx.h> #include <gtk/gtkx.h>
#include <glib-unix.h> #include <glib-unix.h>
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>

View file

@ -439,7 +439,7 @@ struct OSCReceiver::Pimpl : private Thread,
if (listeners.size() > 0 || listenersWithAddress.size() > 0) if (listeners.size() > 0 || listenersWithAddress.size() > 0)
postMessage (new CallbackMessage (content)); postMessage (new CallbackMessage (content));
} }
catch (OSCFormatError) catch (const OSCFormatError&)
{ {
if (formatErrorHandler != nullptr) if (formatErrorHandler != nullptr)
formatErrorHandler (data, (int) dataSize); formatErrorHandler (data, (int) dataSize);