[webkit-dev] Use of [[maybe_unused]]

Suzuki, Basuke Basuke.Suzuki at sony.com
Tue Jan 14 11:55:36 PST 2020

> > `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.

Got it. I'll try sending to EWS to see it works for every ports. 

> 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.

Let us think about the cost to maintain platform dependent implementation of this class.
Because the member variable is assigned in constructor, we have to make platform dependent
Constructor which is usually hard to maintain and want to away from that if possible.

How about this?

template <typename T> struct Unused { explicit Empty(T) { } };	

bool m_isHTTPSCheckEnabled;
[[maybe_unused]] Unused<bool> m_isHTTPSCheckEnabled;

Basuke Suzuki
SONY PlayStation

More information about the webkit-dev mailing list