From 5670cf3bf25db760e6bad6db9b7b8e70978738ab Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Tue, 29 Jul 2014 07:55:22 +0000 Subject: Make IPC macros work with -Wunused-local-typedefs. The typedef can be used by the IPC_MESSAGE_HANDLER macro, but that macro isn't always used when IPC_BEGIN_MESSAGE_MAP is used. The alternatives are to either pass ClassName::HanderFunction to IPC_MESSAGE_HANDLER (like what one has to do to use IPC_MESSAGE_FORWARD), or to mark the typedef in IPC_BEGIN_MESSAGE_MAP as ALLOW_UNUSED so that it isn't warned on. BUG=321833 TBR=brettw Review URL: https://codereview.chromium.org/422083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286115 0039d316-1c4b-4281-b951-d872f2087c98 --- ipc/ipc_message_macros.h | 12 ++++++------ ppapi/proxy/dispatch_reply_message.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 8be5c53..4644113 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -892,7 +892,7 @@ #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ { \ - typedef class_name _IpcMessageHandlerClass; \ + typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED; \ void* param__ = NULL; \ const IPC::Message& ipc_message__ = msg; \ switch (ipc_message__.type()) { @@ -905,11 +905,11 @@ #define IPC_DECLTYPE typeof #endif -#define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ - { \ - typedef class_name _IpcMessageHandlerClass; \ - IPC_DECLTYPE(param) param__ = param; \ - const IPC::Message& ipc_message__ = msg; \ +#define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ + { \ + typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED; \ + IPC_DECLTYPE(param) param__ = param; \ + const IPC::Message& ipc_message__ = msg; \ switch (ipc_message__.type()) { #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ diff --git a/ppapi/proxy/dispatch_reply_message.h b/ppapi/proxy/dispatch_reply_message.h index 1a53e86..ce4c602 100644 --- a/ppapi/proxy/dispatch_reply_message.h +++ b/ppapi/proxy/dispatch_reply_message.h @@ -135,7 +135,7 @@ void DispatchResourceReplyOrDefaultParams( // unused variables or other errors if they're used with these macros. #define PPAPI_BEGIN_MESSAGE_MAP(class_name, msg) \ { \ - typedef class_name _IpcMessageHandlerClass; \ + typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED; \ const IPC::Message& ipc_message__ = msg; \ switch (ipc_message__.type()) { \ -- cgit v1.1