@@ -99,7 +99,7 @@ void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
99
99
if (config.set (cmdline))
100
100
{
101
101
usage_error ();
102
- exit (1 );
102
+ exit (CPROVER_EXIT_USAGE_ERROR );
103
103
}
104
104
105
105
#if 0
@@ -373,7 +373,7 @@ int goto_analyzer_parse_optionst::doit()
373
373
if (cmdline.isset (" version" ))
374
374
{
375
375
std::cout << CBMC_VERSION << ' \n ' ;
376
- return 0 ;
376
+ return CPROVER_EXIT_SUCCESS ;
377
377
}
378
378
379
379
//
@@ -402,35 +402,36 @@ int goto_analyzer_parse_optionst::doit()
402
402
catch (const char *e)
403
403
{
404
404
error () << e << eom;
405
- return true ;
405
+ return CPROVER_EXIT_EXCEPTION ;
406
406
}
407
407
408
408
catch (const std::string &e)
409
409
{
410
410
error () << e << eom;
411
- return true ;
411
+ return CPROVER_EXIT_EXCEPTION ;
412
412
}
413
413
414
- catch (int )
414
+ catch (int e )
415
415
{
416
- return true ;
416
+ error () << " Numeric exception: " << e << eom;
417
+ return CPROVER_EXIT_EXCEPTION;
417
418
}
418
419
419
420
if (process_goto_program (options))
420
- return 6 ;
421
+ return CPROVER_EXIT_INTERNAL_ERROR ;
421
422
422
423
// show it?
423
424
if (cmdline.isset (" show-symbol-table" ))
424
425
{
425
426
::show_symbol_table (goto_model.symbol_table, get_ui());
426
- return 6 ;
427
+ return CPROVER_EXIT_SUCCESS ;
427
428
}
428
429
429
430
// show it?
430
431
if (cmdline.isset (" show-goto-functions" ))
431
432
{
432
433
show_goto_functions (goto_model, get_ui ());
433
- return 6 ;
434
+ return CPROVER_EXIT_SUCCESS ;
434
435
}
435
436
436
437
try
@@ -474,15 +475,15 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
474
475
if (cmdline.isset (" show-taint" ))
475
476
{
476
477
taint_analysis (goto_model, taint_file, get_message_handler (), true , " " );
477
- return 0 ;
478
+ return CPROVER_EXIT_SUCCESS ;
478
479
}
479
480
else
480
481
{
481
482
std::string json_file=cmdline.get_value (" json" );
482
483
bool result=
483
484
taint_analysis (
484
485
goto_model, taint_file, get_message_handler (), false , json_file);
485
- return result? 10 : 0 ;
486
+ return result ? CPROVER_EXIT_VERIFICATION_UNSAFE : CPROVER_EXIT_SUCCESS ;
486
487
}
487
488
}
488
489
@@ -503,13 +504,13 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
503
504
{
504
505
error () << " Failed to open json output `"
505
506
<< json_file << " '" << eom;
506
- return 6 ;
507
+ return CPROVER_EXIT_INTERNAL_ERROR ;
507
508
}
508
509
509
510
unreachable_instructions (goto_model, true , ofs);
510
511
}
511
512
512
- return 0 ;
513
+ return CPROVER_EXIT_SUCCESS ;
513
514
}
514
515
515
516
if (options.get_bool_option (" unreachable-functions" ) &&
@@ -528,13 +529,13 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
528
529
{
529
530
error () << " Failed to open json output `"
530
531
<< json_file << " '" << eom;
531
- return 6 ;
532
+ return CPROVER_EXIT_INTERNAL_ERROR ;
532
533
}
533
534
534
535
unreachable_functions (goto_model, true , ofs);
535
536
}
536
537
537
- return 0 ;
538
+ return CPROVER_EXIT_SUCCESS ;
538
539
}
539
540
540
541
if (options.get_bool_option (" reachable-functions" ) &&
@@ -553,13 +554,13 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
553
554
{
554
555
error () << " Failed to open json output `"
555
556
<< json_file << " '" << eom;
556
- return 6 ;
557
+ return CPROVER_EXIT_INTERNAL_ERROR ;
557
558
}
558
559
559
560
reachable_functions (goto_model, true , ofs);
560
561
}
561
562
562
- return 0 ;
563
+ return CPROVER_EXIT_SUCCESS ;
563
564
}
564
565
565
566
if (options.get_bool_option (" show-local-may-alias" ))
@@ -576,19 +577,19 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
576
577
std::cout << ' \n ' ;
577
578
}
578
579
579
- return 0 ;
580
+ return CPROVER_EXIT_SUCCESS ;
580
581
}
581
582
582
583
label_properties (goto_model);
583
584
584
585
if (cmdline.isset (" show-properties" ))
585
586
{
586
587
show_properties (goto_model, get_ui ());
587
- return 0 ;
588
+ return CPROVER_EXIT_SUCCESS ;
588
589
}
589
590
590
591
if (set_properties ())
591
- return 7 ;
592
+ return CPROVER_EXIT_SET_PROPERTIES_FAILED ;
592
593
593
594
if (options.get_bool_option (" general-analysis" ))
594
595
{
@@ -689,7 +690,7 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
689
690
// Final defensive error case
690
691
error () << " no analysis option given -- consider reading --help"
691
692
<< eom;
692
- return 6 ;
693
+ return CPROVER_EXIT_USAGE_ERROR ;
693
694
}
694
695
695
696
bool goto_analyzer_parse_optionst::set_properties ()
0 commit comments