[webkit-dev] Use of [[maybe_unused]]
achristensen at apple.com
Mon Jan 13 16:49:01 PST 2020
> On Jan 13, 2020, at 4:08 PM, Suzuki, Basuke <Basuke.Suzuki at sony.com> wrote:
> `sessionID` is used in RELEASE_LOG_IF_ALLOWED() and we have empty implementation of RELEASE_LOG() so that it's ended up with unused parameter warning of sessionID. We can add UNUSED_PARAM(sessionID) in this case, but [[maybe_unused]] is more correct choice to describe the code because sessionID is actually used.
In this case you could use RELEASE_LOG_DISABLED but I agree [[maybe_unused]] would be better. I’m ok with it as long as all the ports are OK with it, including support in their oldest supported compiler.
> This member variable is only used in COCOA port. (https://github.com/WebKit/webkit/blob/master/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp#L203)
> We can add UNUSED_PARAM(isHTTPSUpgradeEnabled) in our platform code, but adding [[maybe_unused]] in the header file is straight forward.
I think it would be better to put #if PLATFORM(COCOA) around member variables like this because I don’t think [[maybe_unused]] will remove the additional byte in the structure. Otherwise we’re just wasting memory.
More information about the webkit-dev