@@ -41,7 +41,7 @@ pub struct KaniArgs {
41
41
#[ structopt( long) ]
42
42
pub visualize : bool ,
43
43
/// Keep temporary files generated throughout Kani process
44
- #[ structopt( long) ]
44
+ #[ structopt( long, hidden_short_help ( true ) ) ]
45
45
pub keep_temps : bool ,
46
46
47
47
/// Produce full debug information
@@ -53,20 +53,21 @@ pub struct KaniArgs {
53
53
/// Output processing stages and commands, along with minor debug information
54
54
#[ structopt( long, short) ]
55
55
pub verbose : bool ,
56
- /// Enable usage of unstable options.
56
+ /// Enable usage of unstable options
57
57
#[ structopt( long, hidden_short_help( true ) ) ]
58
58
pub enable_unstable : bool ,
59
59
60
+ // Hide this since it depends on function that is a hidden option.
60
61
/// Print commands instead of running them
61
- #[ structopt( long, requires( "function" ) ) ]
62
+ #[ structopt( long, requires( "function" ) , hidden ( true ) ) ]
62
63
pub dry_run : bool ,
63
64
/// 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
65
66
#[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
66
67
pub gen_c : bool ,
67
68
68
69
// 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
70
71
#[ structopt( long, parse( from_os_str) ) ]
71
72
pub target_dir : Option < PathBuf > ,
72
73
@@ -77,26 +78,24 @@ pub struct KaniArgs {
77
78
#[ structopt( flatten) ]
78
79
pub checks : CheckArgs ,
79
80
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" ) ) ]
82
84
pub function : Option < String > ,
83
85
/// Entry point for verification (proof harness)
84
86
// In a dry-run, we don't have kani-metadata.json to read, so we can't use this flag
85
87
#[ structopt( long, conflicts_with = "function" , conflicts_with = "dry-run" ) ]
86
88
pub harness : Option < String > ,
87
89
88
90
/// 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
90
92
#[ structopt( long, parse( from_os_str) , hidden = true , requires( "enable-unstable" ) ) ]
91
93
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
93
95
#[ structopt( long) ]
94
96
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
96
98
#[ structopt( long, hidden_short_help( true ) ) ]
97
- pub allow_cbmc_verification_failure : bool ,
98
- /// Kani will only compile the crate
99
- #[ structopt( long) ]
100
99
pub only_codegen : bool ,
101
100
102
101
/// Specify the number of bits used for representing object IDs in CBMC
@@ -108,23 +107,20 @@ pub struct KaniArgs {
108
107
/// Specify the value used for loop unwinding for the specified harness in CBMC
109
108
#[ structopt( long, requires( "harness" ) ) ]
110
109
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
116
112
#[ structopt( long, allow_hyphen_values = true , min_values( 0 ) , requires( "enable-unstable" ) ) ]
117
113
// consumes everything
118
114
pub cbmc_args : Vec < OsString > ,
119
115
120
116
// 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
124
120
#[ structopt( long, hidden = true , requires( "enable-unstable" ) ) ]
125
121
pub use_abs : bool ,
126
122
// Hide option till https://github.com/model-checking/kani/issues/697 is
127
- // fixed
123
+ // fixed.
128
124
/// Choose abstraction for modules of standard library if available
129
125
#[ structopt( long, default_value = "std" , possible_values = & AbstractionType :: variants( ) ,
130
126
case_insensitive = true , hidden = true ) ]
@@ -133,12 +129,12 @@ pub struct KaniArgs {
133
129
/// Enable extra pointer checks such as invalid pointers in relation operations and pointer
134
130
/// arithmetic overflow.
135
131
/// 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
137
133
#[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
138
134
pub extra_pointer_checks : bool ,
139
135
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
142
138
#[ structopt( long, hidden_short_help( true ) , requires( "enable-unstable" ) ) ]
143
139
pub restrict_vtable : bool ,
144
140
/// Disable restricting the targets of virtual table function pointer calls
@@ -283,23 +279,13 @@ impl CargoKaniArgs {
283
279
}
284
280
impl KaniArgs {
285
281
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 ( ) ;
292
285
293
286
// TODO: these conflicting flags reflect what's necessary to pass current tests unmodified.
294
287
// 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 {
303
289
Error :: with_description (
304
290
"Conflicting flags: unwind flags provided to kani and in --cbmc-args." ,
305
291
ErrorKind :: ArgumentConflict ,
0 commit comments