OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_ |
6 #define V8_BASE_COMPILER_SPECIFIC_H_ | 6 #define V8_BASE_COMPILER_SPECIFIC_H_ |
7 | 7 |
8 #include "include/v8config.h" | 8 #include "include/v8config.h" |
9 | 9 |
10 // Annotate a typedef or function indicating it's ok if it's not used. | 10 // Annotate a typedef or function indicating it's ok if it's not used. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // }; | 53 // }; |
54 // | 54 // |
55 // In .cc file: | 55 // In .cc file: |
56 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar; | 56 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar; |
57 #if V8_HAS_DECLSPEC_SELECTANY | 57 #if V8_HAS_DECLSPEC_SELECTANY |
58 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) | 58 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) |
59 #else | 59 #else |
60 #define STATIC_CONST_MEMBER_DEFINITION | 60 #define STATIC_CONST_MEMBER_DEFINITION |
61 #endif | 61 #endif |
62 | 62 |
| 63 #if V8_CC_MSVC |
| 64 |
| 65 #include <sal.h> |
| 66 |
| 67 // Macros for suppressing and disabling warnings on MSVC. |
| 68 // |
| 69 // Warning numbers are enumerated at: |
| 70 // http://msdn.microsoft.com/en-us/library/8x5x43k7(VS.80).aspx |
| 71 // |
| 72 // The warning pragma: |
| 73 // http://msdn.microsoft.com/en-us/library/2c8f766e(VS.80).aspx |
| 74 // |
| 75 // Using __pragma instead of #pragma inside macros: |
| 76 // http://msdn.microsoft.com/en-us/library/d9x1s805.aspx |
| 77 |
| 78 // MSVC_SUPPRESS_WARNING disables warning |n| for the remainder of the line and |
| 79 // for the next line of the source file. |
| 80 #define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress : n)) |
| 81 |
| 82 // Allows exporting a class that inherits from a non-exported base class. |
| 83 // This uses suppress instead of push/pop because the delimiter after the |
| 84 // declaration (either "," or "{") has to be placed before the pop macro. |
| 85 // |
| 86 // Example usage: |
| 87 // class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) { |
| 88 // |
| 89 // MSVC Compiler warning C4275: |
| 90 // non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. |
| 91 // Note that this is intended to be used only when no access to the base class' |
| 92 // static data is done through derived classes or inline methods. For more info, |
| 93 // see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx |
| 94 #define NON_EXPORTED_BASE(code) \ |
| 95 MSVC_SUPPRESS_WARNING(4275) \ |
| 96 code |
| 97 |
| 98 #else // Not MSVC |
| 99 |
| 100 #define MSVC_SUPPRESS_WARNING(n) |
| 101 #define NON_EXPORTED_BASE(code) code |
| 102 |
| 103 #endif // V8_CC_MSVC |
| 104 |
63 #endif // V8_BASE_COMPILER_SPECIFIC_H_ | 105 #endif // V8_BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |