OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef BASE_COMPILER_SPECIFIC_H_ |
6 #define BASE_COMPILER_SPECIFIC_H_ | 6 #define BASE_COMPILER_SPECIFIC_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(COMPILER_MSVC) | 10 #if defined(COMPILER_MSVC) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // | 43 // |
44 // Example usage: | 44 // Example usage: |
45 // Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {} | 45 // Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {} |
46 // | 46 // |
47 // Compiler warning C4355: 'this': used in base member initializer list: | 47 // Compiler warning C4355: 'this': used in base member initializer list: |
48 // http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx | 48 // http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx |
49 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \ | 49 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \ |
50 code \ | 50 code \ |
51 MSVC_POP_WARNING() | 51 MSVC_POP_WARNING() |
52 | 52 |
53 #else // COMPILER_MSVC | 53 #else // Not MSVC |
54 | 54 |
55 #define MSVC_SUPPRESS_WARNING(n) | 55 #define MSVC_SUPPRESS_WARNING(n) |
56 #define MSVC_PUSH_DISABLE_WARNING(n) | 56 #define MSVC_PUSH_DISABLE_WARNING(n) |
57 #define MSVC_PUSH_WARNING_LEVEL(n) | 57 #define MSVC_PUSH_WARNING_LEVEL(n) |
58 #define MSVC_POP_WARNING() | 58 #define MSVC_POP_WARNING() |
59 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code | 59 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code |
60 | 60 |
61 #endif // COMPILER_MSVC | 61 #endif // COMPILER_MSVC |
62 | 62 |
| 63 |
| 64 #if defined(COMPILER_GCC) |
| 65 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
| 66 #else // Not GCC |
| 67 #define WARN_UNUSED_RESULT |
| 68 #endif |
| 69 |
63 #endif // BASE_COMPILER_SPECIFIC_H_ | 70 #endif // BASE_COMPILER_SPECIFIC_H_ |
64 | |
OLD | NEW |