@@ -17,6 +17,12 @@ pub enum BuildMode {
17
17
build_module
18
18
}
19
19
20
+ pub enum AssertFailureMode {
21
+ default
22
+ aborts
23
+ backtraces
24
+ }
25
+
20
26
pub enum GarbageCollectionMode {
21
27
no_gc
22
28
boehm_full // full garbage collection mode
@@ -167,6 +173,7 @@ pub mut:
167
173
is_help bool // -h, -help or --help was passed
168
174
gc_mode GarbageCollectionMode = .no_gc // .no_gc, .boehm, .boehm_leak, ...
169
175
is_cstrict bool // turn on more C warnings; slightly slower
176
+ assert_failure_mode AssertFailureMode // whether to call abort() or print_backtrace() after an assertion failure
170
177
// checker settings:
171
178
checker_match_exhaustive_cutoff_limit int = 10
172
179
}
@@ -197,6 +204,23 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
197
204
res.arch = target_arch_kind
198
205
res.build_options << '$arg $target_arch '
199
206
}
207
+ '-assert' {
208
+ assert_mode := cmdline.option (current_args, '-assert' , '' )
209
+ match assert_mode {
210
+ 'aborts' {
211
+ res.assert_failure_mode = .aborts
212
+ }
213
+ 'backtraces' {
214
+ res.assert_failure_mode = .backtraces
215
+ }
216
+ else {
217
+ eprintln ('unknown assert mode `-gc $assert_mode `, supported modes are:`' )
218
+ eprintln (' `-assert aborts` .... calls abort() after assertion failure' )
219
+ eprintln (' `-assert backtraces` .... calls print_backtrace() after assertion failure' )
220
+ exit (1 )
221
+ }
222
+ }
223
+ }
200
224
'-show-timings' {
201
225
res.show_timings = true
202
226
}
0 commit comments