| Index: third_party/mojo/src/mojo/public/cpp/system/macros.h
|
| diff --git a/third_party/mojo/src/mojo/public/cpp/system/macros.h b/third_party/mojo/src/mojo/public/cpp/system/macros.h
|
| index 8c7998961fc2b86df11a7ac64b49ba2d729c6c3f..9836e99f369b82a4b5e056b18eb17a56f34424c2 100644
|
| --- a/third_party/mojo/src/mojo/public/cpp/system/macros.h
|
| +++ b/third_party/mojo/src/mojo/public/cpp/system/macros.h
|
| @@ -42,4 +42,27 @@ char(&ArraySizeHelper(const T(&array)[N]))[N];
|
| typedef void MoveOnlyTypeForCPP03; \
|
| \
|
| private:
|
| +
|
| +// The C++ standard requires that static const members have an out-of-class
|
| +// definition (in a single compilation unit), but MSVC chokes on this (when
|
| +// language extensions, which are required, are enabled). (You're only likely to
|
| +// notice the need for a definition if you take the address of the member or,
|
| +// more commonly, pass it to a function that takes it as a reference argument --
|
| +// probably an STL function.) This macro makes MSVC do the right thing. See
|
| +// http://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx for more
|
| +// information. Use like:
|
| +//
|
| +// In .h file:
|
| +// struct Foo {
|
| +// static const int kBar = 5;
|
| +// };
|
| +//
|
| +// In .cc file:
|
| +// STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar;
|
| +#if defined(_MSC_VER)
|
| +#define MOJO_STATIC_CONST_MEMBER_DEFINITION __declspec(selectany)
|
| +#else
|
| +#define MOJO_STATIC_CONST_MEMBER_DEFINITION
|
| +#endif
|
| +
|
| #endif // MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
|
|
|