summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-04-25 08:34:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-04-25 08:34:17 +0000
commitf030176694f7c12972c4c2b59267220dfb0759c2 (patch)
tree157487ba239a2b89b906b75a5a09f88b3b309fc5
parent662cfb91ccb8a61683790b76b643e966ac005e8d (diff)
downloadperl-MDK-Common-f030176694f7c12972c4c2b59267220dfb0759c2.tar
perl-MDK-Common-f030176694f7c12972c4c2b59267220dfb0759c2.tar.gz
perl-MDK-Common-f030176694f7c12972c4c2b59267220dfb0759c2.tar.bz2
perl-MDK-Common-f030176694f7c12972c4c2b59267220dfb0759c2.tar.xz
perl-MDK-Common-f030176694f7c12972c4c2b59267220dfb0759c2.zip
replace warning "unused variable @_" with "if the function doesn't take any
parameters, please use the empty prototype.\nexample \"sub foo() { ... }\""
-rw-r--r--perl_checker.src/global_checks.ml10
1 files changed, 8 insertions, 2 deletions
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)