@@ -21,13 +21,12 @@ int goto_inspect_parse_optionst::doit()
21
21
return CPROVER_EXIT_SUCCESS;
22
22
}
23
23
24
- // Before we do anything else, positional arguments needs to be > 1.
25
- // (i.e. a filename has been given).
26
- if (cmdline.args .size () < 1 )
24
+ // Before we do anything else, ensure that a file argument has been given.
25
+ if (cmdline.args .size () != 1 )
27
26
{
28
27
help ();
29
28
throw invalid_command_line_argument_exceptiont{
30
- " failed to supply a goto-binary name" ,
29
+ " failed to supply a goto-binary name or an option for inspection " ,
31
30
" <input goto-binary> <inspection-option>" };
32
31
}
33
32
@@ -63,7 +62,13 @@ int goto_inspect_parse_optionst::doit()
63
62
return CPROVER_EXIT_SUCCESS;
64
63
}
65
64
66
- // No options was passed in - erroneously?
65
+ // If an option + binary was provided, the program will have exited gracefully
66
+ // through a different branch. If we hit the code below, it means that something
67
+ // has gone wrong - it's also possible to fall through this case if no optional
68
+ // inspection flag is present in the argument vector. This will ensure that the
69
+ // return value in that case is semantically meaningful, and provide a return
70
+ // value that also satisfies the compiler's requirements based on the signature
71
+ // of `doit()`.
67
72
return CPROVER_EXIT_INCORRECT_TASK;
68
73
}
69
74
0 commit comments