OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_FLAGS_H_ | 5 #ifndef VM_FLAGS_H_ |
6 #define VM_FLAGS_H_ | 6 #define VM_FLAGS_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 | 10 |
11 typedef const char* charp; | 11 typedef const char* charp; |
12 | 12 |
13 #define DECLARE_FLAG(type, name) \ | 13 #define DECLARE_FLAG(type, name) \ |
14 extern type FLAG_##name | 14 extern type FLAG_##name |
15 | 15 |
16 #define DEFINE_FLAG(type, name, default_value, comment) \ | 16 #define DEFINE_FLAG(type, name, default_value, comment) \ |
17 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ | 17 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ |
18 #name, \ | 18 #name, \ |
19 default_value, \ | 19 default_value, \ |
20 comment) | 20 comment) |
21 | 21 |
| 22 #if defined(PRODUCT) |
| 23 #define PRODUCT_FLAG(product_value, type, name, default_value, comment) \ |
| 24 const type FLAG_##name = product_value; |
| 25 |
| 26 #else // defined(PRODUCT) |
| 27 #define PRODUCT_FLAG(product_value, type, name, default_value, comment) \ |
| 28 type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ |
| 29 #name, \ |
| 30 default_value, \ |
| 31 comment) |
| 32 #endif // defined(PRODUCT) |
| 33 |
22 #define DEFINE_FLAG_HANDLER(handler, name, comment) \ | 34 #define DEFINE_FLAG_HANDLER(handler, name, comment) \ |
23 bool DUMMY_##name = Flags::Register_func(handler, #name, comment) | 35 bool DUMMY_##name = Flags::Register_func(handler, #name, comment) |
24 | 36 |
25 | 37 |
26 #if defined(DEBUG) | 38 #if defined(DEBUG) |
27 #define DECLARE_DEBUG_FLAG(type, name) DECLARE_FLAG(type, name) | 39 #define DECLARE_DEBUG_FLAG(type, name) DECLARE_FLAG(type, name) |
28 #define DEFINE_DEBUG_FLAG(type, name, default_value, comment) \ | 40 #define DEFINE_DEBUG_FLAG(type, name, default_value, comment) \ |
29 DEFINE_FLAG(type, name, default_value, comment) | 41 DEFINE_FLAG(type, name, default_value, comment) |
30 #else | 42 #else |
31 #define DECLARE_DEBUG_FLAG(type, name) | 43 #define DECLARE_DEBUG_FLAG(type, name) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // Testing needs direct access to private methods. | 115 // Testing needs direct access to private methods. |
104 friend void Dart_TestParseFlags(); | 116 friend void Dart_TestParseFlags(); |
105 | 117 |
106 DISALLOW_ALLOCATION(); | 118 DISALLOW_ALLOCATION(); |
107 DISALLOW_IMPLICIT_CONSTRUCTORS(Flags); | 119 DISALLOW_IMPLICIT_CONSTRUCTORS(Flags); |
108 }; | 120 }; |
109 | 121 |
110 } // namespace dart | 122 } // namespace dart |
111 | 123 |
112 #endif // VM_FLAGS_H_ | 124 #endif // VM_FLAGS_H_ |
OLD | NEW |