diff --git a/dom/media/webaudio/AnalyserNode.cpp b/dom/media/webaudio/AnalyserNode.cpp index 62258b3c56b..229a14746e8 100644 --- a/dom/media/webaudio/AnalyserNode.cpp +++ b/dom/media/webaudio/AnalyserNode.cpp @@ -93,7 +93,7 @@ AnalyserNode::AnalyserNode(AudioContext* aContext) // Enough chunks must be recorded to handle the case of fftSize being // increased to maximum immediately before getFloatTimeDomainData() is // called, for example. - (void)mChunks.SetLength(CHUNK_COUNT, fallible); + unused << mChunks.SetLength(CHUNK_COUNT, fallible); AllocateBuffer(); } diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h index c72e020806c..f10af874028 100644 --- a/mfbt/Assertions.h +++ b/mfbt/Assertions.h @@ -494,8 +494,18 @@ struct AssertionConditionType # define MOZ_ALWAYS_TRUE(expr) MOZ_ASSERT((expr)) # define MOZ_ALWAYS_FALSE(expr) MOZ_ASSERT(!(expr)) #else -# define MOZ_ALWAYS_TRUE(expr) ((void)(expr)) -# define MOZ_ALWAYS_FALSE(expr) ((void)(expr)) +# define MOZ_ALWAYS_TRUE(expr) \ + do { \ + if ( ( expr ) ) { \ + /* Silence MOZ_WARN_UNUSED_RESULT. */ \ + } \ + } while (0) +# define MOZ_ALWAYS_FALSE(expr) \ + do { \ + if ( ( expr ) ) { \ + /* Silence MOZ_WARN_UNUSED_RESULT. */ \ + } \ + } while (0) #endif #undef MOZ_DUMP_ASSERTION_STACK diff --git a/storage/mozStorageBindingParams.cpp b/storage/mozStorageBindingParams.cpp index c036b78a645..ab0317d228a 100644 --- a/storage/mozStorageBindingParams.cpp +++ b/storage/mozStorageBindingParams.cpp @@ -110,7 +110,7 @@ BindingParams::BindingParams(mozIStorageBindingParamsArray *aOwningArray, , mOwningStatement(aOwningStatement) { (void)mOwningStatement->GetParameterCount(&mParamCount); - (void)mParameters.SetCapacity(mParamCount); + mParameters.SetCapacity(mParamCount); } BindingParams::BindingParams(mozIStorageBindingParamsArray *aOwningArray) diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 655c9e9cdcc..bb16e09d7ff 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -987,8 +987,8 @@ private: { MOZ_ASSERT(NS_IsMainThread(), "This should be called on the main thread"); - (void)mPlaces.SwapElements(aPlaces); - (void)mReferrers.SetLength(mPlaces.Length()); + mPlaces.SwapElements(aPlaces); + mReferrers.SetLength(mPlaces.Length()); for (nsTArray::size_type i = 0; i < mPlaces.Length(); i++) { mReferrers[i].spec = mPlaces[i].referrerSpec; diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 4c3919a211f..d427b33efa6 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -1193,7 +1193,7 @@ public: } template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT bool Assign(const nsTArray_Impl& aOther, const mozilla::fallible_t&) { @@ -1274,7 +1274,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* ReplaceElementsAt(index_type aStart, size_type aCount, const Item* aArray, size_type aArrayLen, const mozilla::fallible_t&) @@ -1295,7 +1295,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* ReplaceElementsAt(index_type aStart, size_type aCount, const nsTArray& aArray, const mozilla::fallible_t&) @@ -1314,7 +1314,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* ReplaceElementsAt(index_type aStart, size_type aCount, const Item& aItem, const mozilla::fallible_t&) { @@ -1339,7 +1339,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementsAt(index_type aIndex, const Item* aArray, size_type aArrayLen, const mozilla::fallible_t&) { @@ -1358,7 +1358,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementsAt(index_type aIndex, const nsTArray_Impl& aArray, const mozilla::fallible_t&) @@ -1385,7 +1385,7 @@ protected: } public: - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementAt(index_type aIndex, const mozilla::fallible_t&) { return InsertElementAt(aIndex); @@ -1409,7 +1409,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementAt(index_type aIndex, Item&& aItem, const mozilla::fallible_t&) { @@ -1466,7 +1466,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementSorted(Item&& aItem, const Comparator& aComp, const mozilla::fallible_t&) { @@ -1486,7 +1486,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementSorted(Item&& aItem, const mozilla::fallible_t&) { return InsertElementSorted( @@ -1728,7 +1728,7 @@ protected: } public: - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT bool SetCapacity(size_type aCapacity, const mozilla::fallible_t&) { return SetCapacity(aCapacity); @@ -1757,7 +1757,7 @@ protected: } public: - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT bool SetLength(size_type aNewLen, const mozilla::fallible_t&) { return SetLength(aNewLen); @@ -1796,7 +1796,7 @@ protected: } public: - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT bool EnsureLengthAtLeast(size_type aMinLen, const mozilla::fallible_t&) { return EnsureLengthAtLeast(aMinLen); @@ -1828,7 +1828,7 @@ protected: } public: - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementsAt(index_type aIndex, size_type aCount, const mozilla::fallible_t&) { @@ -1865,7 +1865,7 @@ protected: public: template - /* MOZ_WARN_UNUSED_RESULT */ + MOZ_WARN_UNUSED_RESULT elem_type* InsertElementsAt(index_type aIndex, size_type aCount, const Item& aItem, const mozilla::fallible_t&) { diff --git a/xpcom/tests/TestTArray.cpp b/xpcom/tests/TestTArray.cpp index e475ace43c3..a75f0e0e5f2 100644 --- a/xpcom/tests/TestTArray.cpp +++ b/xpcom/tests/TestTArray.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/ArrayUtils.h" +#include "mozilla/unused.h" #include #include @@ -1115,9 +1116,9 @@ static bool test_SetLengthAndRetainStorage_no_ctor() { pre t post; \ pre tauto post; \ } while (0) - + // Setup test arrays. - FOR_EACH(;, .SetLength(N, fallible)); + FOR_EACH(; unused << , .SetLength(N, fallible)); for (int n = 0; n < N; ++n) { FOR_EACH(;, [n] = n); }