Chromium Code Reviews| Index: base/compiler_specific.h |
| =================================================================== |
| --- base/compiler_specific.h (revision 85332) |
| +++ base/compiler_specific.h (working copy) |
| @@ -54,6 +54,19 @@ |
| code \ |
| MSVC_POP_WARNING() |
| +// Allows exporting a class that inherits from a non-exported base class. |
| +// This uses suppress instead of push/pop because the delimiter after the |
| +// declaration (either "," or "{") has to be placed before the pop macro. |
| +// |
| +// Example usage: |
| +// Class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) { |
|
brettw
2011/05/18 06:06:18
Did you mean "Class" to be lower-case?
rvargas (doing something else)
2011/05/18 18:13:48
Yes, fixed.
|
| +// |
| +// MSVC Compiler warning C4275: |
| +// non dll-interface class 'Bar' used as base for dll-interface class 'Foo' |
| +// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx |
|
brettw
2011/05/18 06:06:18
Your URL doesn't seem to talk about C4275. I searc
rvargas (doing something else)
2011/05/18 18:13:48
I added this to the comment:
// Note that this is
|
| +#define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \ |
| + code |
| + |
| #else // Not MSVC |
| #define MSVC_SUPPRESS_WARNING(n) |
| @@ -63,6 +76,7 @@ |
| #define MSVC_DISABLE_OPTIMIZE() |
| #define MSVC_ENABLE_OPTIMIZE() |
| #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code |
| +#define NON_EXPORTED_BASE(code) code |
| #endif // COMPILER_MSVC |