Skip to content

Commit 2e07612

Browse files
committed
Add option Cabs2cil.addLoopConditionLabels
1 parent 8704ff9 commit 2e07612

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/frontc/cabs2cil.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ let alwaysGenerateVarDecl = false
8686
*)
8787
let addNestedScopeAttr = ref false
8888

89+
let addLoopConditionLabels = ref false
90+
8991
(** Indicates whether we're allowed to duplicate small chunks. *)
9092
let allowDuplication: bool ref = ref true
9193

@@ -1258,7 +1260,10 @@ let consLabContinue (c: chunk) =
12581260
| NotWhile lr :: rest -> if !lr = "" then c else consLabel !lr c !currentLoc false
12591261

12601262
let consLabLoopCondition (c: chunk) =
1261-
consLabel (newLabelName "__loop_condition") c !currentLoc false
1263+
if !addLoopConditionLabels then
1264+
consLabel (newLabelName "__loop_condition") c !currentLoc false
1265+
else
1266+
c
12621267

12631268
let break_env = Stack.create ()
12641269

src/frontc/cabs2cil.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ val nocil: int ref
5656
*)
5757
val addNestedScopeAttr: bool ref
5858

59+
(** Add [__loop_condition] labels before syntactic loop conditions. *)
60+
val addLoopConditionLabels: bool ref
61+
5962
(** Indicates whether we're allowed to duplicate small chunks of code. *)
6063
val allowDuplication: bool ref
6164

0 commit comments

Comments
 (0)