summaryrefslogtreecommitdiffstats
path: root/base/compiler_specific.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 18:29:36 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 18:29:36 +0000
commit13677b86fc97aeab327e476c7de42bc777a54ee4 (patch)
tree5e2682e91c0d09d63a6a54e36d9996fef5528e8d /base/compiler_specific.h
parentd929a9dfff856658662a962fd4dabed66d1e0b2f (diff)
downloadchromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.zip
chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.gz
chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.bz2
net: Add NET_API to net/base
BUG=76997 TEST=NONE Review URL: http://codereview.chromium.org/6969077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/compiler_specific.h')
-rw-r--r--base/compiler_specific.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 43ff21c..99e4f8e 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -54,6 +54,21 @@
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) {
+//
+// MSVC Compiler warning C4275:
+// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'.
+// Note that this is intended to be used only when no access to the base class
+// can be gained through the derived class. For more info, see
+// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
+#define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \
+ code
+
#else // Not MSVC
#define MSVC_SUPPRESS_WARNING(n)
@@ -63,6 +78,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