Commit 151311e3 authored by binji@chromium.org's avatar binji@chromium.org

[NaCl SDK] nacl_io: fix warning of macro redefinition on Windows.

windows.h defines BEGIN_INTERFACE -- we need to undefine it before we redefine
it.

BUG=none
R=sbc@chromium.org

Review URL: https://codereview.chromium.org/13998024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194632 0039d316-1c4b-4281-b951-d872f2087c98
parent b50de00a
......@@ -33,12 +33,12 @@
// Forward declare interface classes.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
class BaseClass;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
int PPErrorToErrno(int32_t err);
......@@ -51,15 +51,16 @@ class PepperInterface {
virtual bool IsMainThread() = 0;
// Interface getters.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
virtual BaseClass* Get##BaseClass() = 0;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
};
// Interface class definitions.
#include "nacl_io/pepper/undef_macros.h"
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
class BaseClass { \
public: \
......@@ -78,7 +79,6 @@ class PepperInterface {
Type4) \
virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4) = 0;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
class ScopedResource {
......
......@@ -11,12 +11,12 @@
#include "pepper_interface.h"
// Forward declare interface classes.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
class Real##BaseClass;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
class RealPepperInterface : public PepperInterface {
public:
......@@ -29,12 +29,12 @@ class RealPepperInterface : public PepperInterface {
virtual bool IsMainThread();
// Interface getters.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
virtual BaseClass* Get##BaseClass();
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
int32_t InitializeMessageLoop();
......@@ -44,12 +44,12 @@ class RealPepperInterface : public PepperInterface {
const PPB_MessageLoop* message_loop_interface_;
// Interface pointers.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
Real##BaseClass* BaseClass##interface_;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
};
#endif // LIBRARIES_NACL_IO_REAL_PEPPER_INTERFACE_H_
......@@ -9,12 +9,12 @@ PepperInterfaceMock::PepperInterfaceMock(PP_Instance instance)
: instance_(instance),
// Initialize interfaces.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
BaseClass##interface_(new BaseClass##Mock),
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
// Dummy value so we can ensure that no interface ends the initializer list.
dummy_(0) {
......@@ -23,12 +23,12 @@ PepperInterfaceMock::PepperInterfaceMock(PP_Instance instance)
PepperInterfaceMock::~PepperInterfaceMock() {
// Delete interfaces.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
delete BaseClass##interface_;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
}
......@@ -37,6 +37,7 @@ PP_Instance PepperInterfaceMock::GetInstance() {
}
// Define Getter functions, constructors, destructors.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
......@@ -48,4 +49,3 @@ PP_Instance PepperInterfaceMock::GetInstance() {
BaseClass##Mock::~BaseClass##Mock() { \
}
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
......@@ -9,6 +9,7 @@
#include "nacl_io/pepper_interface.h"
// Mock interface class definitions.
#include "nacl_io/pepper/undef_macros.h"
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
class BaseClass##Mock : public BaseClass { \
public: \
......@@ -28,7 +29,6 @@
Type4) \
MOCK_METHOD5(MethodName, ReturnType(Type0, Type1, Type2, Type3, Type4));
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
class PepperInterfaceMock : public PepperInterface {
......@@ -42,23 +42,23 @@ class PepperInterfaceMock : public PepperInterface {
MOCK_METHOD0(IsMainThread, bool());
// Interface getters.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
virtual BaseClass##Mock* Get##BaseClass();
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
private:
PP_Instance instance_;
// Interface pointers.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
BaseClass##Mock* BaseClass##interface_;
#include "nacl_io/pepper/all_interfaces.h"
#include "nacl_io/pepper/undef_macros.h"
int dummy_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment