@@ -41,7 +41,7 @@ pub struct KaniArgs {
4141 #[ structopt( long) ]
4242 pub visualize : bool ,
4343 /// Keep temporary files generated throughout Kani process
44- #[ structopt( long) ]
44+ #[ structopt( long, hidden_short_help ( true ) ) ]
4545 pub keep_temps : bool ,
4646
4747 /// Produce full debug information
@@ -53,20 +53,21 @@ pub struct KaniArgs {
5353 /// Output processing stages and commands, along with minor debug information
5454 #[ structopt( long, short) ]
5555 pub verbose : bool ,
56- /// Enable usage of unstable options.
56+ /// Enable usage of unstable options
5757 #[ structopt( long, hidden_short_help( true ) ) ]
5858 pub enable_unstable : bool ,
5959
60+ // Hide this since it depends on function that is a hidden option.
6061 /// Print commands instead of running them
61- #[ structopt( long, requires( "function" ) ) ]
62+ #[ structopt( long, requires( "function" ) , hidden ( true ) ) ]
6263 pub dry_run : bool ,
6364 /// Generate C file equivalent to inputted program.
64- /// This feature is unstable and it requires `--enable-unstable` to be used.
65+ /// This feature is unstable and it requires `--enable-unstable` to be used
6566 #[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
6667 pub gen_c : bool ,
6768
6869 // TODO: currently only cargo-kani pays attention to this.
69- /// Directory for all generated artifacts
70+ /// Directory for all generated artifacts. Only effective when running Kani with cargo
7071 #[ structopt( long, parse( from_os_str) ) ]
7172 pub target_dir : Option < PathBuf > ,
7273
@@ -77,26 +78,24 @@ pub struct KaniArgs {
7778 #[ structopt( flatten) ]
7879 pub checks : CheckArgs ,
7980
80- /// Entry point for verification (symbol name)
81- #[ structopt( long, hidden = true ) ]
81+ /// Entry point for verification (symbol name).
82+ /// This is an unstable feature. Consider using --harness instead
83+ #[ structopt( long, hidden = true , requires( "enable-unstable" ) ) ]
8284 pub function : Option < String > ,
8385 /// Entry point for verification (proof harness)
8486 // In a dry-run, we don't have kani-metadata.json to read, so we can't use this flag
8587 #[ structopt( long, conflicts_with = "function" , conflicts_with = "dry-run" ) ]
8688 pub harness : Option < String > ,
8789
8890 /// Link external C files referenced by Rust code.
89- /// This is an experimental feature and requires `--enable-unstable` to be used.
91+ /// This is an experimental feature and requires `--enable-unstable` to be used
9092 #[ structopt( long, parse( from_os_str) , hidden = true , requires( "enable-unstable" ) ) ]
9193 pub c_lib : Vec < PathBuf > ,
92- /// Enable test function verification. Only use this option when the entry point is a test function.
94+ /// Enable test function verification. Only use this option when the entry point is a test function
9395 #[ structopt( long) ]
9496 pub tests : bool ,
95- /// Do not produce error return code on CBMC verification failure
97+ /// Kani will only compile the crate. No verification will be performed
9698 #[ structopt( long, hidden_short_help( true ) ) ]
97- pub allow_cbmc_verification_failure : bool ,
98- /// Kani will only compile the crate
99- #[ structopt( long) ]
10099 pub only_codegen : bool ,
101100
102101 /// Specify the number of bits used for representing object IDs in CBMC
@@ -108,23 +107,20 @@ pub struct KaniArgs {
108107 /// Specify the value used for loop unwinding for the specified harness in CBMC
109108 #[ structopt( long, requires( "harness" ) ) ]
110109 pub unwind : Option < u32 > ,
111- /// Turn on automatic loop unwinding
112- #[ structopt( long) ]
113- pub auto_unwind : bool ,
114- /// Pass through directly to CBMC; must be the last flag
115- /// This feature is unstable and it requires `--enable-unstable` to be used.
110+ /// Pass through directly to CBMC; must be the last flag.
111+ /// This feature is unstable and it requires `--enable-unstable` to be used
116112 #[ structopt( long, allow_hyphen_values = true , min_values( 0 ) , requires( "enable-unstable" ) ) ]
117113 // consumes everything
118114 pub cbmc_args : Vec < OsString > ,
119115
120116 // Hide option till https://github.com/model-checking/kani/issues/697 is
121- // fixed
122- /// Use abstractions for the standard library
123- /// This is an experimental feature and requires `--enable-unstable` to be used.
117+ // fixed.
118+ /// Use abstractions for the standard library.
119+ /// This is an experimental feature and requires `--enable-unstable` to be used
124120 #[ structopt( long, hidden = true , requires( "enable-unstable" ) ) ]
125121 pub use_abs : bool ,
126122 // Hide option till https://github.com/model-checking/kani/issues/697 is
127- // fixed
123+ // fixed.
128124 /// Choose abstraction for modules of standard library if available
129125 #[ structopt( long, default_value = "std" , possible_values = & AbstractionType :: variants( ) ,
130126 case_insensitive = true , hidden = true ) ]
@@ -133,12 +129,12 @@ pub struct KaniArgs {
133129 /// Enable extra pointer checks such as invalid pointers in relation operations and pointer
134130 /// arithmetic overflow.
135131 /// This feature is unstable and it may yield false counter examples. It requires
136- /// `--enable-unstable` to be used.
132+ /// `--enable-unstable` to be used
137133 #[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
138134 pub extra_pointer_checks : bool ,
139135
140- /// Restrict the targets of virtual table function pointer calls
141- /// This feature is unstable and it requires `--enable-unstable` to be used.
136+ /// Restrict the targets of virtual table function pointer calls.
137+ /// This feature is unstable and it requires `--enable-unstable` to be used
142138 #[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
143139 pub restrict_vtable : bool ,
144140 /// Disable restricting the targets of virtual table function pointer calls
@@ -283,23 +279,13 @@ impl CargoKaniArgs {
283279}
284280impl KaniArgs {
285281 pub fn validate ( & self ) {
286- let extra_unwind = self . cbmc_args . contains ( & OsString :: from ( "--unwind" ) ) ;
287- let extra_auto_unwind = self . cbmc_args . contains ( & OsString :: from ( "--auto-unwind" ) ) ;
288- let extras = extra_auto_unwind || extra_unwind;
289- let natives = self . auto_unwind || self . default_unwind . is_some ( ) ;
290- let any_auto_unwind = extra_auto_unwind || self . auto_unwind ;
291- let any_unwind = self . default_unwind . is_some ( ) || extra_unwind;
282+ let extra_unwind =
283+ self . cbmc_args . iter ( ) . any ( |s| s. to_str ( ) . unwrap ( ) . starts_with ( "--unwind" ) ) ;
284+ let natives_unwind = self . default_unwind . is_some ( ) || self . unwind . is_some ( ) ;
292285
293286 // TODO: these conflicting flags reflect what's necessary to pass current tests unmodified.
294287 // We should consider improving the error messages slightly in a later pull request.
295- if any_auto_unwind && any_unwind {
296- Error :: with_description (
297- "Conflicting flags: `--auto-unwind` is not compatible with other `--default-unwind` flags." ,
298- ErrorKind :: ArgumentConflict ,
299- )
300- . exit ( ) ;
301- }
302- if natives && extras {
288+ if natives_unwind && extra_unwind {
303289 Error :: with_description (
304290 "Conflicting flags: unwind flags provided to kani and in --cbmc-args." ,
305291 ErrorKind :: ArgumentConflict ,
0 commit comments