You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letdead_locations : unit Deadcode.Locmap.t =Deadcode.Locmap.create 10in
83
83
letmoduleNH = Hashtbl.Make (Node) in
84
84
letlive_nodes : unit NH.t =NH.create 10in
85
-
let count =ref0in(* Is only populated if "dbg.print_dead_code" is true *)
85
+
let count =ref0in(* Is only populated if "ana.dead-code.lines" or "ana.dead-code.branches" is true *)
86
86
letmoduleStringMap = BatMap.Make (String) in
87
87
letopenBatPrintfin
88
88
let live_lines =refStringMap.empty in
@@ -149,9 +149,9 @@ struct
149
149
M.msg_group Warning~category:Deadcode"Function '%s' has dead code" f msgs
150
150
in
151
151
letwarn_filef=StringMap.iter (warn_func f) in
152
-
if get_bool "dbg.print_dead_code"then (
152
+
if get_bool "ana.dead-code.lines"then (
153
153
ifStringMap.is_empty !dead_lines
154
-
then printf "No lines with dead code found by solver (there might still be dead code removed by CIL).\n"(* TODO https://github.com/goblint/analyzer/issues/94 *)
154
+
then printf "No lines with dead code found by solver.\n"
155
155
else (
156
156
StringMap.iter warn_file !dead_lines; (* populates count by side-effect *)
157
157
let total_dead =!count + uncalled_fn_loc in
@@ -160,13 +160,14 @@ struct
160
160
printf "Total lines (logical LoC): %d\n" (live_count +!count + uncalled_fn_loc); (* We can only give total LoC if we counted dead code *)
161
161
);
162
162
letstr=functiontrue ->"then"|false ->"else"in
163
+
letcilinserted=functiontrue ->"(possibly inserted by CIL) "|false ->""in
163
164
letreporttv (loc, dead) =
164
165
match dead, Deadcode.Locmap.find_option Deadcode.dead_branches_cond loc with
165
-
|true, Someexp -> M.warn ~loc~category:Deadcode~tags:[CWE (if tv then570else571)] "the %s branch over expression '%a' is dead" (str tv) d_exp exp
166
-
|true, None -> M.warn ~loc~category:Deadcode~tags:[CWE (if tv then570else571)] "an %s branch is dead" (str tv)
166
+
|true, Someexp -> M.warn ~loc~category:Deadcode~tags:[CWE (if tv then570else571)] "the %s branch %sover expression '%a' is dead" (str tv) (cilinserted loc.synthetic) d_exp exp
0 commit comments