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

Side by Side Diff: runtime/bin/main.cc

Issue 2084553003: Better command line error messages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return false; 200 return false;
201 } 201 }
202 verbose_option = true; 202 verbose_option = true;
203 return true; 203 return true;
204 } 204 }
205 205
206 206
207 static bool ProcessPackageRootOption(const char* arg, 207 static bool ProcessPackageRootOption(const char* arg,
208 CommandLineOptions* vm_options) { 208 CommandLineOptions* vm_options) {
209 ASSERT(arg != NULL); 209 ASSERT(arg != NULL);
210 if (*arg == '\0' || *arg == '-') { 210 if (*arg == '-') {
211 return false; 211 return false;
212 } 212 }
213 commandline_package_root = arg; 213 commandline_package_root = arg;
214 return true; 214 return true;
215 } 215 }
216 216
217 217
218 static bool ProcessPackagesOption(const char* arg, 218 static bool ProcessPackagesOption(const char* arg,
219 CommandLineOptions* vm_options) { 219 CommandLineOptions* vm_options) {
220 ASSERT(arg != NULL); 220 ASSERT(arg != NULL);
221 if ((*arg == '\0') || (*arg == '-')) { 221 if (*arg == '-') {
222 return false; 222 return false;
223 } 223 }
224 commandline_packages_file = arg; 224 commandline_packages_file = arg;
225 return true; 225 return true;
226 } 226 }
227 227
228 228
229 static void* GetHashmapKeyFromString(char* key) { 229 static void* GetHashmapKeyFromString(char* key) {
230 return reinterpret_cast<void*>(key); 230 return reinterpret_cast<void*>(key);
231 } 231 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 i++; 585 i++;
586 } 586 }
587 587
588 // Verify consistency of arguments. 588 // Verify consistency of arguments.
589 if ((commandline_package_root != NULL) && 589 if ((commandline_package_root != NULL) &&
590 (commandline_packages_file != NULL)) { 590 (commandline_packages_file != NULL)) {
591 Log::PrintErr("Specifying both a packages directory and a packages " 591 Log::PrintErr("Specifying both a packages directory and a packages "
592 "file is invalid.\n"); 592 "file is invalid.\n");
593 return -1; 593 return -1;
594 } 594 }
595 if ((commandline_package_root != NULL) &&
596 (strlen(commandline_package_root) == 0)) {
597 Log::PrintErr("Empty package root specified.\n");
598 return -1;
599 }
600 if ((commandline_packages_file != NULL) &&
601 (strlen(commandline_packages_file) == 0)) {
602 Log::PrintErr("Empty package file name specified.\n");
603 return -1;
604 }
595 if (is_noopt && gen_snapshot_kind != kNone) { 605 if (is_noopt && gen_snapshot_kind != kNone) {
596 Log::PrintErr("Generating a snapshot with dart_noopt is invalid.\n"); 606 Log::PrintErr("Generating a snapshot with dart_noopt is invalid.\n");
597 return -1; 607 return -1;
598 } 608 }
599 if ((gen_snapshot_kind != kNone) && (snapshot_filename == NULL)) { 609 if ((gen_snapshot_kind != kNone) && (snapshot_filename == NULL)) {
600 Log::PrintErr("Generating a snapshot requires a filename (--snapshot).\n"); 610 Log::PrintErr("Generating a snapshot requires a filename (--snapshot).\n");
601 return -1; 611 return -1;
602 } 612 }
603 if ((gen_snapshot_kind != kNone) && run_app_snapshot) { 613 if ((gen_snapshot_kind != kNone) && run_app_snapshot) {
604 Log::PrintErr("Specifying an option to generate a snapshot and" 614 Log::PrintErr("Specifying an option to generate a snapshot and"
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 Platform::Exit(Process::GlobalExitCode()); 1749 Platform::Exit(Process::GlobalExitCode());
1740 } 1750 }
1741 1751
1742 } // namespace bin 1752 } // namespace bin
1743 } // namespace dart 1753 } // namespace dart
1744 1754
1745 int main(int argc, char** argv) { 1755 int main(int argc, char** argv) {
1746 dart::bin::main(argc, argv); 1756 dart::bin::main(argc, argv);
1747 UNREACHABLE(); 1757 UNREACHABLE();
1748 } 1758 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698