Bug 1713212 - Convert uses of mozilla::Unused to void casts in rest of JS code r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D116169
This commit is contained in:
Steve Fink 2021-05-28 21:41:33 +00:00
parent 6b4b736415
commit c38113a399
18 changed files with 18 additions and 35 deletions

View File

@ -18,7 +18,6 @@
#include "mozilla/FloatingPoint.h"
#include "mozilla/Maybe.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Unused.h"
#include "jsapi.h"
#include "jsfriendapi.h"
@ -952,7 +951,7 @@ FutexThread::WaitResult js::FutexThread::wait(
}
if (isTimed) {
mozilla::Unused << cond_->wait_until(locked, *sliceEnd);
(void)cond_->wait_until(locked, *sliceEnd);
} else {
cond_->wait(locked);
}

View File

@ -4439,7 +4439,7 @@ static bool OriginalPromiseThenBuiltin(JSContext* cx, HandleValue promiseVal,
if (!cx->isExceptionPending()) {
// Reject the promise, but also propagate this uncatchable error.
mozilla::Unused << PromiseObject::reject(cx, promise, UndefinedHandleValue);
(void)PromiseObject::reject(cx, promise, UndefinedHandleValue);
return false;
}

View File

@ -12,7 +12,6 @@
#include "mozilla/PodOperations.h"
#include "mozilla/Range.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Unused.h"
#include <algorithm>
#include <limits>

View File

@ -16,7 +16,6 @@
#include "mozilla/TextUtils.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/Tuple.h"
#include "mozilla/Unused.h"
#include <algorithm>
#include <cfloat>
@ -2849,7 +2848,7 @@ static bool NewString(JSContext* cx, unsigned argc, Value* vp) {
cx, buf.get(), len, &TestExternalStringCallbacks, &isExternal, heap);
}
if (dest && isExternal) {
mozilla::Unused << buf.release(); // Ownership was transferred.
(void)buf.release(); // Ownership was transferred.
}
} else {
AutoStableStringChars stable(cx);

View File

@ -9,7 +9,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Unused.h"
#include <stddef.h>
#include <stdint.h>
@ -284,8 +283,8 @@ static UListFormatter* NewUListFormatter(JSContext* cx,
MOZ_ASSERT(type == ListFormatType::Conjunction);
MOZ_ASSERT(style == ListFormatStyle::Long);
mozilla::Unused << type;
mozilla::Unused << style;
(void)type;
(void)style;
lf = ulistfmt_open(IcuLocale(locale.get()), &status);
#endif

View File

@ -12,7 +12,6 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/Sprintf.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/Vector.h"
#include "mozilla/WrappingOperations.h"

View File

@ -6953,7 +6953,7 @@ JS_PUBLIC_API bool FireOnGarbageCollectionHook(
Debugger* dbg = Debugger::fromJSObject(triggered.back());
if (dbg->getHook(Debugger::OnGarbageCollection)) {
mozilla::Unused << dbg->enterDebuggerHook(cx, [&]() -> bool {
(void)dbg->enterDebuggerHook(cx, [&]() -> bool {
return dbg->fireOnGarbageCollectionHook(cx, data);
});
MOZ_ASSERT(!cx->isExceptionPending());

View File

@ -17,7 +17,6 @@
#include "mozilla/Maybe.h" // mozilla::{Maybe,Nothing,Some}
#include "mozilla/PodOperations.h" // mozilla::PodCopy
#include "mozilla/Sprintf.h" // SprintfLiteral
#include "mozilla/Unused.h" // mozilla::Unused
#include "mozilla/Variant.h" // mozilla::AsVariant
#include <algorithm>
@ -93,7 +92,6 @@ using mozilla::NumberEqualsInt32;
using mozilla::NumberIsInt32;
using mozilla::PodCopy;
using mozilla::Some;
using mozilla::Unused;
static bool ParseNodeRequiresSpecialLineNumberNotes(ParseNode* pn) {
// The few node types listed below are exceptions to the usual

View File

@ -7,7 +7,6 @@
#include "frontend/FunctionEmitter.h"
#include "mozilla/Assertions.h" // MOZ_ASSERT
#include "mozilla/Unused.h"
#include "builtin/ModuleObject.h" // ModuleObject
#include "frontend/AsyncEmitter.h" // AsyncEmitter
@ -312,7 +311,7 @@ bool FunctionEmitter::emitTopLevelFunction(GCThingIndex index) {
// NOTE: The `index` is not directly stored as an opcode, but we collect the
// range of indices in `BytecodeEmitter::emitDeclarationInstantiation` instead
// of discrete indices.
mozilla::Unused << index;
(void)index;
return true;
}

View File

@ -24,7 +24,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Range.h"
#include "mozilla/Sprintf.h"
#include "mozilla/Unused.h"
#include "mozilla/Utf8.h"
#include "mozilla/Variant.h"

View File

@ -392,7 +392,7 @@ TaggedParserAtomIndex ParserAtomsTable::internUtf8(
uint32_t length = 0;
InflatedChar16Sequence<mozilla::Utf8Unit> seqCopy = seq;
while (seqCopy.hasMore()) {
mozilla::Unused << seqCopy.next();
(void)seqCopy.next();
length += 1;
}

View File

@ -12,7 +12,6 @@
#include "mozilla/MemoryReporting.h" // mozilla::MallocSizeOf
#include "mozilla/Range.h" // mozilla::Range
#include "mozilla/Span.h" // mozilla::Span
#include "mozilla/Unused.h" // mozilla::Unused
#include "mozilla/Variant.h" // mozilla::Variant
#include <stddef.h> // size_t
@ -284,7 +283,7 @@ class ScopeStencil {
(isArrow ? IsArrow : 0)) {
MOZ_ASSERT((kind == ScopeKind::Function) == functionIndex.isSome());
// Silence -Wunused-private-field warnings.
mozilla::Unused << padding_;
(void)padding_;
}
private:

View File

@ -191,7 +191,6 @@
#include "mozilla/PodOperations.h"
#include "mozilla/Span.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/Utf8.h"
#include <algorithm>

View File

@ -1,7 +1,5 @@
#include "gdb-tests.h"
#include "mozilla/Unused.h"
#include "jsapi.h"
#include "js/CompileOptions.h"
@ -32,7 +30,7 @@ FRAGMENT(GCCellPtr, simple) {
JS::CompileOptions options(cx);
options.setFileAndLine(__FILE__, __LINE__);
JS::SourceText<char16_t> srcBuf;
mozilla::Unused << srcBuf.init(cx, nullptr, 0, JS::SourceOwnership::Borrowed);
(void)srcBuf.init(cx, nullptr, 0, JS::SourceOwnership::Borrowed);
JS::RootedScript emptyScript(cx, JS::Compile(cx, options, srcBuf));
// Inline TraceKinds.

View File

@ -7,7 +7,6 @@
#include "mozilla/Maybe.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "gc/GCRuntime.h"
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
@ -356,7 +355,7 @@ bool TestWrapperType() {
Rooted<ObjectT> obj0(cx, CreateTenuredGCThing<JSObject>(cx));
WrapperT wrapper0(obj0);
MakeGray(obj0);
mozilla::Unused << *wrapper0;
(void)*wrapper0;
CHECK(obj0->isMarkedBlack());
}
@ -382,8 +381,8 @@ bool TestWrapperType() {
template <typename WrapperT, typename ObjectT>
bool TestUnbarrieredOperations(ObjectT obj, ObjectT obj2, WrapperT& wrapper,
WrapperT& wrapper2) {
mozilla::Unused << bool(wrapper);
mozilla::Unused << bool(wrapper2);
(void)bool(wrapper);
(void)bool(wrapper2);
CHECK(obj->isMarkedGray());
CHECK(obj2->isMarkedGray());

View File

@ -14,7 +14,6 @@
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/RandomNum.h"
#include "mozilla/Unused.h"
#include "mozilla/WrappingOperations.h"
#include <cmath>

View File

@ -18,7 +18,6 @@
#include "mozilla/Sprintf.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtrExtensions.h" // UniqueFreePtr
#include "mozilla/Unused.h"
#include "mozilla/Utf8.h"
#include "mozilla/Variant.h"
@ -1125,8 +1124,8 @@ static bool MaybeRunFinalizationRegistryCleanupTasks(JSContext* cx) {
{
AutoReportException are(cx);
RootedValue unused(cx);
mozilla::Unused << JS_CallFunction(cx, nullptr, callback,
HandleValueArray::empty(), &unused);
(void)JS_CallFunction(cx, nullptr, callback, HandleValueArray::empty(),
&unused);
}
ranTasks = true;
@ -1587,8 +1586,8 @@ static bool AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) {
{
// Report exceptions but keep going.
AutoReportException are(cx);
mozilla::Unused << EvalUtf8AndPrint(cx, buffer.begin(), buffer.length(),
startline, compileOnly);
(void)EvalUtf8AndPrint(cx, buffer.begin(), buffer.length(), startline,
compileOnly);
}
// If a let or const fail to initialize they will remain in an unusable
@ -6555,7 +6554,7 @@ class AutoCStringVector {
}
// Now owned by this vector.
mozilla::Unused << arg.release();
(void)arg.release();
return true;
}
char* const* get() const { return argv_.begin(); }

View File

@ -8,7 +8,6 @@
#include "mozilla/Latin1.h"
#include "mozilla/Range.h"
#include "mozilla/Unused.h"
#include <algorithm>