Bug 224787 - Remove UNUSED warnings based on the configuration.
Summary: Remove UNUSED warnings based on the configuration.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-19 16:10 PDT by Basuke Suzuki
Modified: 2021-04-23 02:48 PDT (History)
15 users (show)

See Also:


Attachments
PATCH (13.88 KB, patch)
2021-04-19 16:22 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH (13.99 KB, patch)
2021-04-19 16:40 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH (12.17 KB, patch)
2021-04-19 16:51 PDT, Basuke Suzuki
darin: review+
Details | Formatted Diff | Diff
PATCH (12.55 KB, patch)
2021-04-19 18:32 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH (13.08 KB, patch)
2021-04-19 21:57 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2021-04-19 16:10:14 PDT
Many warnings are came from the result when RELEASE_LOG is disabled.
Comment 1 Basuke Suzuki 2021-04-19 16:22:03 PDT
Created attachment 426490 [details]
PATCH
Comment 2 Basuke Suzuki 2021-04-19 16:40:29 PDT
Created attachment 426494 [details]
PATCH
Comment 3 Basuke Suzuki 2021-04-19 16:51:19 PDT
Created attachment 426495 [details]
PATCH
Comment 4 Darin Adler 2021-04-19 17:00:00 PDT
Comment on attachment 426495 [details]
PATCH

View in context: https://bugs.webkit.org/attachment.cgi?id=426495&action=review

> Source/WebCore/loader/SubresourceLoader.cpp:311
> +            UNUSED_VARIABLE(this);

This isn’t the best fix. The correct fix is to not capture this, since we’re not using it. Not sure we should be capturing protectedThis either.

> Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:540
>      unsigned numberOfBatches = std::ceil(domains.size() / static_cast<float>(maxNumberOfDomainsInOneLogStatement));
> +    UNUSED_VARIABLE(numberOfBatches);

Better fix is to wrap this line in:

#if !RELEASE_LOG_DISABLED
#endif

> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:359
> +#endif

I think this #endif should be up above, not wrapped around the entire block. We don’t want or need to nest the #if

> Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:160
>      RELEASE_LOG(ServiceWorker, "Created service worker %" PRIu64 " in process PID %i", serviceWorkerIdentifier.toUInt64(), getCurrentProcessID());
> +    UNUSED_VARIABLE(serviceWorkerIdentifier);

Better fix is to use data.serviceWorkerIdentifier in the RELEASE_LOG line and get rid of the local variable.

> Source/WebKit/WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:55
> +static UNUSED_FUNCTION uint64_t pageIDFromWebFrame(const RefPtr<WebFrame>& frame)

Better fix is to put these functions inside #if !RELEASE_LOG_DISABLED.
Comment 5 Basuke Suzuki 2021-04-19 17:12:00 PDT
Comment on attachment 426495 [details]
PATCH

View in context: https://bugs.webkit.org/attachment.cgi?id=426495&action=review

>> Source/WebCore/loader/SubresourceLoader.cpp:311
>> +            UNUSED_VARIABLE(this);
> 
> This isn’t the best fix. The correct fix is to not capture this, since we’re not using it. Not sure we should be capturing protectedThis either.

But `this` is uses in RELEASE_LOG_IF_ALLOWED macro. It will be warned if RELEASE_LOG_DISABLED.

>> Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:540
>> +    UNUSED_VARIABLE(numberOfBatches);
> 
> Better fix is to wrap this line in:
> 
> #if !RELEASE_LOG_DISABLED
> #endif

Right.

>> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:359
>> +#endif
> 
> I think this #endif should be up above, not wrapped around the entire block. We don’t want or need to nest the #if

Ah, okay. Make sense.

>> Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:160
>> +    UNUSED_VARIABLE(serviceWorkerIdentifier);
> 
> Better fix is to use data.serviceWorkerIdentifier in the RELEASE_LOG line and get rid of the local variable.

Right.

>> Source/WebKit/WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:55
>> +static UNUSED_FUNCTION uint64_t pageIDFromWebFrame(const RefPtr<WebFrame>& frame)
> 
> Better fix is to put these functions inside #if !RELEASE_LOG_DISABLED.

Right.
Comment 6 Basuke Suzuki 2021-04-19 17:27:06 PDT
Comment on attachment 426495 [details]
PATCH

View in context: https://bugs.webkit.org/attachment.cgi?id=426495&action=review

>>> Source/WebCore/loader/SubresourceLoader.cpp:311
>>> +            UNUSED_VARIABLE(this);
>> 
>> This isn’t the best fix. The correct fix is to not capture this, since we’re not using it. Not sure we should be capturing protectedThis either.
> 
> But `this` is uses in RELEASE_LOG_IF_ALLOWED macro. It will be warned if RELEASE_LOG_DISABLED.

I will add RELEASE_LOG_IF_ALLOWED for RELEASE_LOG_DISABLED case.

>>> Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:160
>>> +    UNUSED_VARIABLE(serviceWorkerIdentifier);
>> 
>> Better fix is to use data.serviceWorkerIdentifier in the RELEASE_LOG line and get rid of the local variable.
> 
> Right.

Ah, no. it is passed with WTFMove(data). We shouldn't use that. Wrap with #!RELEASE_LOG_DISABLED.
Comment 7 Basuke Suzuki 2021-04-19 18:32:25 PDT
Created attachment 426504 [details]
PATCH
Comment 8 Darin Adler 2021-04-19 19:03:52 PDT
Comment on attachment 426504 [details]
PATCH

View in context: https://bugs.webkit.org/attachment.cgi?id=426504&action=review

> Source/WebKit/WebProcess/WebProcess.cpp:1469
> +        UNUSED_VARIABLE(this);

Don’t need this any more since you put a fix into RELEASE_LOG_IF_ALLOWED
Comment 9 Basuke Suzuki 2021-04-19 19:45:09 PDT
Comment on attachment 426504 [details]
PATCH

View in context: https://bugs.webkit.org/attachment.cgi?id=426504&action=review

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:2214
> +        UNUSED_VARIABLE(this);

Can we do something for this?

>> Source/WebKit/WebProcess/WebProcess.cpp:1469
>> +        UNUSED_VARIABLE(this);
> 
> Don’t need this any more since you put a fix into RELEASE_LOG_IF_ALLOWED

That was defined in SubresourceLoader.cpp, so I have to define that here for this file. Okay.
Comment 10 Basuke Suzuki 2021-04-19 21:57:01 PDT
Created attachment 426518 [details]
PATCH
Comment 11 EWS 2021-04-20 08:47:32 PDT
Committed r276306 (236788@main): <https://commits.webkit.org/236788@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426518 [details].
Comment 12 Ling Ho 2021-04-23 02:47:49 PDT
rdar://76900340