[Webkit-unassigned] [Bug 143750] Use UNUSED_PARAM instead of the void casting to suppress unused parameter warnings

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 16 09:41:11 PDT 2015


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

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #250795|review?                     |review+
              Flags|                            |

--- Comment #14 from Darin Adler <darin at apple.com> ---
Comment on attachment 250795
  --> https://bugs.webkit.org/attachment.cgi?id=250795
Patch

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

I’m OK with this as is, but it doesn’t really seem like much of an improvement.

> Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp:67
>  NotificationPermissionRequestManager::NotificationPermissionRequestManager(WebPage* page)
> +{
>  #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
> -    : m_page(page)
> +    m_page = page;
> +#else
> +    UNUSED_PARAM(page);
>  #endif
> -{
> -    (void)page;
>  }

I don’t really like the way this changes from initialization syntax to assignment syntax. I’d prefer to avoid both UNUSED_PARAM and (void) myself by just repeating the function twice:

#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)

NotificationPermissionRequestManager::NotificationPermissionRequestManager(WebPage* page)
    : m_page(page)
{
}

#else

NotificationPermissionRequestManager::NotificationPermissionRequestManager(WebPage*)
{
}

#endif

One nice thing about that is that it clears the way for further refinement, for example, we could make the empty constructor inline by putting it in the header and marking it inline without making the non-empty constructor be inlined.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150416/558dacc5/attachment.html>


More information about the webkit-unassigned mailing list