From 7fcec7e036a842ba24e302279fd6a1b131773931 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 25 Apr 2003 08:34:17 +0000 Subject: replace warning "unused variable @_" with "if the function doesn't take any parameters, please use the empty prototype.\nexample \"sub foo() { ... }\"" --- perl_checker.src/global_checks.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'perl_checker.src') diff --git a/perl_checker.src/global_checks.ml b/perl_checker.src/global_checks.ml index f10b6ff..f51811a 100644 --- a/perl_checker.src/global_checks.ml +++ b/perl_checker.src/global_checks.ml @@ -232,8 +232,14 @@ let un_parenthesize_one_elt_List = function | l -> l let check_unused_local_variables vars = - List.iter (fun ((_, s as v), (pos, used, _proto)) -> - if not !used && (s.[0] != '_' || s = "_") && not (List.mem s [ "BEGIN"; "END"; "DESTROY" ]) then warn_with_pos pos (sprintf "unused variable %s" (variable2s v)) + List.iter (fun ((context, s as v), (pos, used, _proto)) -> + if not !used then + match s with + | "BEGIN" | "END" | "DESTROY" -> () + | "_" when context = I_array -> + warn_with_pos pos "if the function doesn't take any parameters, please use the empty prototype.\nexample \"sub foo() { ... }\"" + | _ -> + if s.[0] != '_' || s = "_" then warn_with_pos pos (sprintf "unused variable %s" (variable2s v)) ) (List.hd vars.my_vars) -- cgit v1.2.1