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

Unified Diff: runtime/vm/flags.cc

Issue 10854224: Sort the Dart vm flags before printing them out with the --print-flags option. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Drop unused variable. Created 8 years, 4 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/flags.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flags.cc
diff --git a/runtime/vm/flags.cc b/runtime/vm/flags.cc
index d02a0a246879bdb8bfa7aed442d8ca17762f4576..e18c43e7e46b64516bb2b6ce9b952fa32c67d4cd 100644
--- a/runtime/vm/flags.cc
+++ b/runtime/vm/flags.cc
@@ -301,15 +301,38 @@ bool Flags::ProcessCommandLineFlags(int number_of_vm_flags,
}
}
if (FLAG_print_flags) {
+ PrintFlags();
+ }
+ return true;
+}
+
+
+int Flags::CompareFlagNames(const void* left, const void* right) {
+ const Flag* left_flag = *reinterpret_cast<const Flag* const *>(left);
+ const Flag* right_flag = *reinterpret_cast<const Flag* const *>(right);
+ return strcmp(left_flag->name_, right_flag->name_);
+}
+
+
+void Flags::PrintFlags() {
OS::Print("Flag settings:\n");
Flag* flag = Flags::flags_;
+ int num_flags = 0;
while (flag != NULL) {
- flag->Print();
+ num_flags++;
flag = flag->next_;
}
- }
+ Flag** flag_array = new Flag*[num_flags];
+ flag = Flags::flags_;
+ for (int i = 0; i < num_flags; ++i, flag = flag->next_) {
+ flag_array[i] = flag;
+ }
- return true;
-}
+ qsort(flag_array, num_flags, sizeof flag_array[0], CompareFlagNames);
+ for (int i = 0; i < num_flags; ++i) {
+ flag_array[i]->Print();
+ }
+ delete[] flag_array;
+ }
} // namespace dart
« no previous file with comments | « runtime/vm/flags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698