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

Side by Side Diff: src/flags.cc

Issue 13811020: Use PrintF instead of fprintf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/disassembler.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // lookup the flag 360 // lookup the flag
361 Flag* flag = FindFlag(name); 361 Flag* flag = FindFlag(name);
362 if (flag == NULL) { 362 if (flag == NULL) {
363 if (remove_flags) { 363 if (remove_flags) {
364 // We don't recognize this flag but since we're removing 364 // We don't recognize this flag but since we're removing
365 // the flags we recognize we assume that the remaining flags 365 // the flags we recognize we assume that the remaining flags
366 // will be processed somewhere else so this flag might make 366 // will be processed somewhere else so this flag might make
367 // sense there. 367 // sense there.
368 continue; 368 continue;
369 } else { 369 } else {
370 fprintf(stderr, "Error: unrecognized flag %s\n" 370 PrintF(stderr, "Error: unrecognized flag %s\n"
371 "Try --help for options\n", arg); 371 "Try --help for options\n", arg);
372 return_code = j; 372 return_code = j;
373 break; 373 break;
374 } 374 }
375 } 375 }
376 376
377 // if we still need a flag value, use the next argument if available 377 // if we still need a flag value, use the next argument if available
378 if (flag->type() != Flag::TYPE_BOOL && 378 if (flag->type() != Flag::TYPE_BOOL &&
379 flag->type() != Flag::TYPE_ARGS && 379 flag->type() != Flag::TYPE_ARGS &&
380 value == NULL) { 380 value == NULL) {
381 if (i < *argc) { 381 if (i < *argc) {
382 value = argv[i++]; 382 value = argv[i++];
383 } else { 383 } else {
384 fprintf(stderr, "Error: missing value for flag %s of type %s\n" 384 PrintF(stderr, "Error: missing value for flag %s of type %s\n"
385 "Try --help for options\n", 385 "Try --help for options\n",
386 arg, Type2String(flag->type())); 386 arg, Type2String(flag->type()));
387 return_code = j; 387 return_code = j;
388 break; 388 break;
389 } 389 }
390 } 390 }
391 391
392 // set the flag 392 // set the flag
393 char* endp = const_cast<char*>(""); // *endp is only read 393 char* endp = const_cast<char*>(""); // *endp is only read
394 switch (flag->type()) { 394 switch (flag->type()) {
395 case Flag::TYPE_BOOL: 395 case Flag::TYPE_BOOL:
396 *flag->bool_variable() = !is_bool; 396 *flag->bool_variable() = !is_bool;
(...skipping 20 matching lines...) Expand all
417 *flag->args_variable() = JSArguments::Create(js_argc, js_argv); 417 *flag->args_variable() = JSArguments::Create(js_argc, js_argv);
418 i = *argc; // Consume all arguments 418 i = *argc; // Consume all arguments
419 break; 419 break;
420 } 420 }
421 } 421 }
422 422
423 // handle errors 423 // handle errors
424 if ((flag->type() == Flag::TYPE_BOOL && value != NULL) || 424 if ((flag->type() == Flag::TYPE_BOOL && value != NULL) ||
425 (flag->type() != Flag::TYPE_BOOL && is_bool) || 425 (flag->type() != Flag::TYPE_BOOL && is_bool) ||
426 *endp != '\0') { 426 *endp != '\0') {
427 fprintf(stderr, "Error: illegal value for flag %s of type %s\n" 427 PrintF(stderr, "Error: illegal value for flag %s of type %s\n"
428 "Try --help for options\n", 428 "Try --help for options\n",
429 arg, Type2String(flag->type())); 429 arg, Type2String(flag->type()));
430 return_code = j; 430 return_code = j;
431 break; 431 break;
432 } 432 }
433 433
434 // remove the flag & value from the command 434 // remove the flag & value from the command
435 if (remove_flags) { 435 if (remove_flags) {
436 while (j < i) { 436 while (j < i) {
437 argv[j++] = NULL; 437 argv[j++] = NULL;
438 } 438 }
439 } 439 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 540
541 541
542 void FlagList::EnforceFlagImplications() { 542 void FlagList::EnforceFlagImplications() {
543 #define FLAG_MODE_DEFINE_IMPLICATIONS 543 #define FLAG_MODE_DEFINE_IMPLICATIONS
544 #include "flag-definitions.h" 544 #include "flag-definitions.h"
545 #undef FLAG_MODE_DEFINE_IMPLICATIONS 545 #undef FLAG_MODE_DEFINE_IMPLICATIONS
546 } 546 }
547 547
548 } } // namespace v8::internal 548 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/disassembler.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698