Index: runtime/vm/flags.h |
diff --git a/runtime/vm/flags.h b/runtime/vm/flags.h |
index f703c1000512f53324936c5531cc9c3326bd6c9b..8a52213238de131022e223f8e3ebf847074de92b 100644 |
--- a/runtime/vm/flags.h |
+++ b/runtime/vm/flags.h |
@@ -6,8 +6,10 @@ |
#define VM_FLAGS_H_ |
#include "platform/assert.h" |
+#include "vm/flag_list.h" |
#include "vm/globals.h" |
+ |
typedef const char* charp; |
#define DECLARE_FLAG(type, name) \ |
@@ -17,20 +19,11 @@ typedef const char* charp; |
type FLAG_##name = Flags::Register_##type(&FLAG_##name, \ |
#name, \ |
default_value, \ |
- comment) |
+ comment); |
#define DEFINE_FLAG_HANDLER(handler, name, comment) \ |
- bool DUMMY_##name = Flags::Register_func(handler, #name, comment) |
- |
+ bool DUMMY_##name = Flags::Register_func(handler, #name, comment); |
-#if defined(DEBUG) |
-#define DECLARE_DEBUG_FLAG(type, name) DECLARE_FLAG(type, name) |
-#define DEFINE_DEBUG_FLAG(type, name, default_value, comment) \ |
- DEFINE_FLAG(type, name, default_value, comment) |
-#else |
-#define DECLARE_DEBUG_FLAG(type, name) |
-#define DEFINE_DEBUG_FLAG(type, name, default_value, comment) |
-#endif |
namespace dart { |
@@ -107,6 +100,35 @@ class Flags { |
DISALLOW_IMPLICIT_CONSTRUCTORS(Flags); |
}; |
+#define PRODUCT_FLAG_MARCO(name, type, default_value, comment) \ |
+ extern type FLAG_##name; |
+ |
+#if defined(DEBUG) |
+#define DEBUG_FLAG_MARCO(name, type, default_value, comment) \ |
+ extern type FLAG_##name; |
+#else // defined(DEBUG) |
+#define DEBUG_FLAG_MARCO(name, type, default_value, comment) \ |
+ const type FLAG_##name = default_value; |
+#endif // defined(DEBUG) |
+ |
+#if defined(PRODUCT) |
+#define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \ |
+ const type FLAG_##name = product_value; |
+ |
+#else // defined(PRODUCT) |
+ |
+#define RELEASE_FLAG_MARCO(name, product_value, type, default_value, comment) \ |
+ extern type FLAG_##name; |
+ |
+#endif // defined(PRODUCT) |
+ |
+// Now declare all flags here. |
+FLAG_LIST(PRODUCT_FLAG_MARCO, RELEASE_FLAG_MARCO, DEBUG_FLAG_MARCO) |
+ |
+#undef RELEASE_FLAG_MARCO |
+#undef DEBUG_FLAG_MARCO |
+#undef PRODUCT_FLAG_MARCO |
+ |
} // namespace dart |
#endif // VM_FLAGS_H_ |