OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MOJO_PUBLIC_SYSTEM_MACROS_H_ | 5 #ifndef MOJO_PUBLIC_C_SYSTEM_MACROS_H_ |
6 #define MOJO_PUBLIC_SYSTEM_MACROS_H_ | 6 #define MOJO_PUBLIC_C_SYSTEM_MACROS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 // Annotate a variable indicating it's okay if it's unused. | 10 // Annotate a variable indicating it's okay if it's unused. |
11 // Use like: | 11 // Use like: |
12 // int x MOJO_ALLOW_UNUSED = ...; | 12 // int x MOJO_ALLOW_UNUSED = ...; |
13 #if defined(__GNUC__) | 13 #if defined(__GNUC__) |
14 #define MOJO_ALLOW_UNUSED __attribute__((unused)) | 14 #define MOJO_ALLOW_UNUSED __attribute__((unused)) |
15 #else | 15 #else |
16 #define MOJO_ALLOW_UNUSED | 16 #define MOJO_ALLOW_UNUSED |
17 #endif | 17 #endif |
18 | 18 |
19 // Annotate a function indicating that the caller must examine the return value. | 19 // Annotate a function indicating that the caller must examine the return value. |
20 // Use like: | 20 // Use like: |
21 // int foo() MOJO_WARN_UNUSED_RESULT; | 21 // int foo() MOJO_WARN_UNUSED_RESULT; |
22 // Note that it can only be used on the prototype, and not the definition. | 22 // Note that it can only be used on the prototype, and not the definition. |
23 #if defined(__GNUC__) | 23 #if defined(__GNUC__) |
24 #define MOJO_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 24 #define MOJO_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
25 #else | 25 #else |
26 #define MOJO_WARN_UNUSED_RESULT | 26 #define MOJO_WARN_UNUSED_RESULT |
27 #endif | 27 #endif |
28 | 28 |
29 // C++-only macros ------------------------------------------------------------- | 29 // C++-only macros ------------------------------------------------------------- |
30 | 30 |
31 #ifdef __cplusplus | 31 #ifdef __cplusplus |
darin (slow to review)
2014/03/26 18:07:20
I guess we can just have a cpp/system/macros_cpp.h
| |
32 | 32 |
33 // Annotate a virtual method indicating it must be overriding a virtual method | 33 // Annotate a virtual method indicating it must be overriding a virtual method |
34 // in the parent class. Use like: | 34 // in the parent class. Use like: |
35 // virtual void foo() OVERRIDE; | 35 // virtual void foo() OVERRIDE; |
36 #if defined(_MSC_VER) || defined(__clang__) | 36 #if defined(_MSC_VER) || defined(__clang__) |
37 #define MOJO_OVERRIDE override | 37 #define MOJO_OVERRIDE override |
38 #else | 38 #else |
39 #define MOJO_OVERRIDE | 39 #define MOJO_OVERRIDE |
40 #endif | 40 #endif |
41 | 41 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 type(type&); \ | 73 type(type&); \ |
74 void operator=(type&); \ | 74 void operator=(type&); \ |
75 public: \ | 75 public: \ |
76 operator rvalue_type() { return rvalue_type(this); } \ | 76 operator rvalue_type() { return rvalue_type(this); } \ |
77 type Pass() { return type(rvalue_type(this)); } \ | 77 type Pass() { return type(rvalue_type(this)); } \ |
78 typedef void MoveOnlyTypeForCPP03; \ | 78 typedef void MoveOnlyTypeForCPP03; \ |
79 private: | 79 private: |
80 | 80 |
81 #endif // __cplusplus | 81 #endif // __cplusplus |
82 | 82 |
83 #endif // MOJO_PUBLIC_SYSTEM_MACROS_H_ | 83 #endif // MOJO_PUBLIC_C_SYSTEM_MACROS_H_ |
OLD | NEW |