Warn of unused loop index variables

Summary: public

Reviewed By: jvillard

Differential Revision: D2938287

fb-gh-sync-id: b244528
shipit-source-id: b244528
master
Josh Berdine 10 years ago committed by facebook-github-bot-5
parent bd8284443c
commit 2f47142b94

@ -90,8 +90,10 @@ OCAMLBUILD_OPTIONS = \
-cflags -w,@19 \ -cflags -w,@19 \
-cflags -w,@20 \ -cflags -w,@20 \
-cflags -w,@26 \ -cflags -w,@26 \
-cflags -w,@35 \
-cflags -w,@38 \ -cflags -w,@38 \
-cflags -w,@39 \ -cflags -w,@39 \
-tag-line "<*clang/clang_ast_*>: warn(-35-39)" \
-lflags $(OCAML_INCLUDES) \ -lflags $(OCAML_INCLUDES) \
-cflags $(OCAML_INCLUDES) \ -cflags $(OCAML_INCLUDES) \
$(addprefix -lib ,$(OCAML_LIBS)) \ $(addprefix -lib ,$(OCAML_LIBS)) \

@ -26,11 +26,11 @@ module Codegen = struct
for file_nr = 1 to num_files do for file_nr = 1 to num_files do
let fname = Printf.sprintf "file%04d.c" file_nr in let fname = Printf.sprintf "file%04d.c" file_nr in
let fmt = open_out fname in let fmt = open_out fname in
for i = 1 to num_functions do for _ = 1 to num_functions do
incr fun_nr; incr fun_nr;
let num_calls = if !fun_nr = 1 then 0 else Random.int calls_per_fun in let num_calls = if !fun_nr = 1 then 0 else Random.int calls_per_fun in
Printf.fprintf fmt "void f%04d() {\n" !fun_nr; Printf.fprintf fmt "void f%04d() {\n" !fun_nr;
for call_nr = 1 to num_calls do for _ = 1 to num_calls do
let callee_nr = 1 + Random.int (max 1 (num_calls - 1)) in let callee_nr = 1 + Random.int (max 1 (num_calls - 1)) in
Printf.fprintf fmt "f%04d();\n" callee_nr Printf.fprintf fmt "f%04d();\n" callee_nr
done; done;

@ -839,7 +839,7 @@ module Stats = struct
let res = ref [] in let res = ref [] in
let indent_string n = let indent_string n =
let s = ref "" in let s = ref "" in
for i = 1 to n do s := " " ^ !s done; for _ = 1 to n do s := " " ^ !s done;
!s in !s in
let num = ref 0 in let num = ref 0 in
let loc_to_string lt = let loc_to_string lt =

@ -163,7 +163,7 @@ let d_ln () = add_print_action (PTstrln, Obj.repr "")
(** dump an indentation *) (** dump an indentation *)
let d_indent indent = let d_indent indent =
let s = ref "" in let s = ref "" in
for i = 1 to indent do s := " " ^ !s done; for _ = 1 to indent do s := " " ^ !s done;
if indent <> 0 then add_print_action (PTstr, Obj.repr !s) if indent <> 0 then add_print_action (PTstr, Obj.repr !s)
(** dump command to increase the indentation level *) (** dump command to increase the indentation level *)

@ -106,7 +106,7 @@ let force_delayed_print fmt =
Sil.pp_atom pe_default fmt a Sil.pp_atom pe_default fmt a
| (L.PTdecrease_indent, n) -> | (L.PTdecrease_indent, n) ->
let (n: int) = Obj.obj n in let (n: int) = Obj.obj n in
for i = 1 to n do F.fprintf fmt "@]" done for _ = 1 to n do F.fprintf fmt "@]" done
| (L.PTexp, e) -> | (L.PTexp, e) ->
let (e: Sil.exp) = Obj.obj e in let (e: Sil.exp) = Obj.obj e in
Sil.pp_exp pe_default fmt e Sil.pp_exp pe_default fmt e
@ -119,7 +119,7 @@ let force_delayed_print fmt =
| (L.PTincrease_indent, n) -> | (L.PTincrease_indent, n) ->
let (n: int) = Obj.obj n in let (n: int) = Obj.obj n in
let s = ref "" in let s = ref "" in
for i = 1 to n do s := " " ^ !s done; for _ = 1 to n do s := " " ^ !s done;
F.fprintf fmt "%s@[" !s F.fprintf fmt "%s@[" !s
| (L.PTinstr, i) -> | (L.PTinstr, i) ->
let (i: Sil.instr) = Obj.obj i in let (i: Sil.instr) = Obj.obj i in

@ -2403,7 +2403,7 @@ module ModelBuiltins = struct
match args with match args with
| _ when IList.length args >= skip_n_arguments -> | _ when IList.length args >= skip_n_arguments ->
let varargs = ref args in let varargs = ref args in
for i = 1 to skip_n_arguments do varargs := IList.tl !varargs done; for _ = 1 to skip_n_arguments do varargs := IList.tl !varargs done;
call_unknown_or_scan true cfg pdesc tenv prop path ret_ids None !varargs callee_pname loc call_unknown_or_scan true cfg pdesc tenv prop path ret_ids None !varargs callee_pname loc
| _ -> raise (Exceptions.Wrong_argument_number __POS__) | _ -> raise (Exceptions.Wrong_argument_number __POS__)

@ -1 +0,0 @@
<clang_ast_{b,j,t,v}.ml>: warn(-39)
Loading…
Cancel
Save