Skip to content

Commit

Permalink
Remove warnings in NativePromise when both log and release log are di…
Browse files Browse the repository at this point in the history
…sabled.

https://bugs.webkit.org/show_bug.cgi?id=261899

Reviewed by Youenn Fablet.

Add conditional UNUSED_PARAMs to additional methods in NativePromise when
both LOG_DISABLED and RELEASE_LOG_DISABLED are true.

* Source/WTF/wtf/NativePromise.h:

Canonical link: https://commits.webkit.org/268318@main
  • Loading branch information
foopoiuyt committed Sep 22, 2023
1 parent 75bd7ac commit c24c489
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/WTF/wtf/NativePromise.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ class NativePromise final : public NativePromiseBase, public ConvertibleToNative
{
static_assert(std::is_convertible_v<RejectValueType_, RejectValueT>, "reject() argument must be implicitly convertible to NativePromise's RejectValueT");
Locker lock { m_lock };
#if LOG_DISABLED && RELEASE_LOG_DISABLED
UNUSED_PARAM(rejectSite);
#endif
PROMISE_LOG("%s rejecting NativePromise (%p created at %s)", rejectSite, this, m_creationSite);
ASSERT(isNothing());
m_result = Unexpected<RejectValueT>(std::forward<RejectValueType_>(rejectValue));
Expand All @@ -370,6 +373,9 @@ class NativePromise final : public NativePromiseBase, public ConvertibleToNative
{
Locker lock { m_lock };
ASSERT(isNothing());
#if LOG_DISABLED && RELEASE_LOG_DISABLED
UNUSED_PARAM(site);
#endif
PROMISE_LOG("%s resolveOrRejecting NativePromise (%p created at %s)", site, this, m_creationSite);
m_result = std::forward<ResolveOrRejectValue_>(result);
dispatchAll(lock);
Expand All @@ -379,6 +385,9 @@ class NativePromise final : public NativePromiseBase, public ConvertibleToNative
{
static_assert(IsExclusive, "setDispatchMode can only be used with exclusive promises");
Locker lock { m_lock };
#if LOG_DISABLED && RELEASE_LOG_DISABLED
UNUSED_PARAM(site);
#endif
PROMISE_LOG("%s runSynchronouslyOnTarget NativePromise (%p created at %s)", site, this, m_creationSite);
ASSERT(isNothing(), "A Promise must not have been already resolved or rejected to set dispatch state");
m_dispatchMode = dispatchMode;
Expand Down Expand Up @@ -664,6 +673,9 @@ class NativePromise final : public NativePromiseBase, public ConvertibleToNative
Locker lock { m_lock };
ASSERT(!IsExclusive || !m_haveRequest, "Using an exclusive promise in a non-exclusive fashion");
m_haveRequest = true;
#if LOG_DISABLED && RELEASE_LOG_DISABLED
UNUSED_PARAM(callSite);
#endif
PROMISE_LOG("%s invoking then() [this:%p, callback:%p, isNothing:%d]", callSite, this, thenCallback.ptr(), isNothing());
if (!isNothing())
thenCallback->dispatch(*this, lock);
Expand Down

0 comments on commit c24c489

Please sign in to comment.