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. |
|
wtc
2011/05/16 23:07:13
Nit: add '-' between 'non' and 'exported'.
|
| +// 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) { |
| +// |
| +// Compiler warning C4275: |
|
wtc
2011/05/16 23:07:13
Nit: add "MSVC"
|
| +// non dll-interface class 'Bar' used as base for dll-interface class 'Foo' |
| +// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx |
| +#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 |