Skip to content

Commit 631e7b0

Browse files
committed
Replace "bounds_check" by ID_C_bounds_check
Replaces the hard-coded string by a dstringt to avoid typos, and also changes it to a comment: the annotation (communicating from the front-end to goto_checkt) does not change the semantics of the expression that has been annotated.
1 parent cf88f82 commit 631e7b0

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/analyses/goto_check.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,9 +1317,12 @@ void goto_checkt::bounds_check(
13171317
if(!enable_bounds_check)
13181318
return;
13191319

1320-
if(expr.find("bounds_check").is_not_nil() &&
1321-
!expr.get_bool("bounds_check"))
1320+
if(
1321+
expr.find(ID_C_bounds_check).is_not_nil() &&
1322+
!expr.get_bool(ID_C_bounds_check))
1323+
{
13221324
return;
1325+
}
13231326

13241327
typet array_type = expr.array().type();
13251328

src/ansi-c/ansi_c_entry_point.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ bool generate_ansi_c_start_function(
407407
argv_symbol.symbol_expr(), argc_symbol.symbol_expr());
408408

409409
// disable bounds check on that one
410-
index_expr.set("bounds_check", false);
410+
index_expr.set(ID_C_bounds_check, false);
411411

412412
init_code.add(code_assignt(index_expr, null));
413413
}
@@ -423,7 +423,7 @@ bool generate_ansi_c_start_function(
423423
index_exprt index_expr(
424424
envp_symbol.symbol_expr(), envp_size_symbol.symbol_expr());
425425
// disable bounds check on that one
426-
index_expr.set("bounds_check", false);
426+
index_expr.set(ID_C_bounds_check, false);
427427

428428
equal_exprt is_null(std::move(index_expr), std::move(null));
429429

@@ -449,7 +449,7 @@ bool generate_ansi_c_start_function(
449449
argv_symbol.symbol_expr(), from_integer(0, index_type()));
450450

451451
// disable bounds check on that one
452-
index_expr.set("bounds_check", false);
452+
index_expr.set(ID_C_bounds_check, false);
453453

454454
const pointer_typet &pointer_type =
455455
to_pointer_type(parameters[1].type());

src/goto-programs/string_abstraction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ void string_abstractiont::abstract_function_call(
567567

568568
index_exprt idx(str_args.back(), from_integer(0, index_type()));
569569
// disable bounds check on that one
570-
idx.set("bounds_check", false);
570+
idx.set(ID_C_bounds_check, false);
571571

572572
str_args.back()=address_of_exprt(idx);
573573
}

src/util/irep_ids.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ IREP_ID_ONE(statement_list_instructions)
841841
IREP_ID_ONE(max)
842842
IREP_ID_ONE(min)
843843
IREP_ID_ONE(constant_interval)
844+
IREP_ID_TWO(C_bounds_check, #bounds_check)
845+
IREP_ID_ONE(count_leading_zeros)
844846

845847
// Projects depending on this code base that wish to extend the list of
846848
// available ids should provide a file local_irep_ids.def in their source tree

0 commit comments

Comments
 (0)