Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: runtime/vm/flags.h

Issue 1663863002: Add product mode: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Reworked the flags setting: Moving to single file for all flag defintions. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/flags.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698