Skip to content

Commit 63dfc94

Browse files
committed
Add --no-malloc-fail parameter
So that the malloc failure configuration can be returned to non failure, without using the full `--no-standard-checks` option.
1 parent 032a284 commit 63dfc94

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: src/util/config.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,11 @@ bool configt::set(const cmdlinet &cmdline)
11271127
ansi_c.malloc_failure_mode = ansi_c.malloc_failure_mode_assert_then_assume;
11281128

11291129
ansi_c.malloc_may_fail = cmdline.isset("malloc-may-fail");
1130+
if(cmdline.isset("no-malloc-fail"))
1131+
{
1132+
ansi_c.malloc_may_fail = false;
1133+
ansi_c.malloc_failure_mode = ansi_ct::malloc_failure_mode_none;
1134+
}
11301135

11311136
if(cmdline.isset("c89"))
11321137
ansi_c.set_c89();

Diff for: src/util/config.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ class symbol_table_baset;
7070
" {y--no-library} \t disable built-in abstract C library\n"
7171

7272
#define OPT_CONFIG_LIBRARY \
73-
"(malloc-fail-assert)(malloc-fail-null)(malloc-may-fail)" \
73+
"(malloc-fail-assert)(malloc-fail-null)(malloc-may-fail)(no-malloc-fail)" \
7474
"(string-abstraction)"
7575

7676
#define HELP_CONFIG_LIBRARY \
7777
" {y--malloc-may-fail} \t allow malloc calls to return a null pointer\n" \
7878
" {y--malloc-fail-assert} \t " \
7979
"set malloc failure mode to assert-then-assume\n" \
8080
" {y--malloc-fail-null} \t set malloc failure mode to return null\n" \
81+
" {y--no-malloc-fail} \t Disable potential malloc failure.\n" \
8182
" {y--string-abstraction} \t track C string lengths and zero-termination\n"
8283

8384
#define OPT_CONFIG_JAVA "(classpath)(cp)(main-class)"

0 commit comments

Comments
 (0)