| 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 #include "vm/flags.h" | 5 #include "vm/flags.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 unrecognized_count++; | 294 unrecognized_count++; |
| 295 } | 295 } |
| 296 flag = flag->next_; | 296 flag = flag->next_; |
| 297 } | 297 } |
| 298 if (unrecognized_count > 0) { | 298 if (unrecognized_count > 0) { |
| 299 OS::PrintErr("\n"); | 299 OS::PrintErr("\n"); |
| 300 exit(255); | 300 exit(255); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 if (FLAG_print_flags) { | 303 if (FLAG_print_flags) { |
| 304 OS::Print("Flag settings:\n"); | 304 PrintFlags(); |
| 305 Flag* flag = Flags::flags_; | |
| 306 while (flag != NULL) { | |
| 307 flag->Print(); | |
| 308 flag = flag->next_; | |
| 309 } | |
| 310 } | 305 } |
| 311 | |
| 312 return true; | 306 return true; |
| 313 } | 307 } |
| 314 | 308 |
| 309 |
| 310 int Flags::CompareFlagNames(const void* left, const void* right) { |
| 311 const Flag* left_flag = *reinterpret_cast<const Flag* const *>(left); |
| 312 const Flag* right_flag = *reinterpret_cast<const Flag* const *>(right); |
| 313 return strcmp(left_flag->name_, right_flag->name_); |
| 314 } |
| 315 |
| 316 |
| 317 void Flags::PrintFlags() { |
| 318 OS::Print("Flag settings:\n"); |
| 319 Flag* flag = Flags::flags_; |
| 320 int num_flags = 0; |
| 321 while (flag != NULL) { |
| 322 num_flags++; |
| 323 flag = flag->next_; |
| 324 } |
| 325 Flag** flag_array = new Flag*[num_flags]; |
| 326 flag = Flags::flags_; |
| 327 for (int i = 0; i < num_flags; ++i, flag = flag->next_) { |
| 328 flag_array[i] = flag; |
| 329 } |
| 330 |
| 331 qsort(flag_array, num_flags, sizeof flag_array[0], CompareFlagNames); |
| 332 |
| 333 for (int i = 0; i < num_flags; ++i) { |
| 334 flag_array[i]->Print(); |
| 335 } |
| 336 delete[] flag_array; |
| 337 } |
| 315 } // namespace dart | 338 } // namespace dart |
| OLD | NEW |