summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
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
commit7fcec7e036a842ba24e302279fd6a1b131773931 (patch)
tree65226a2ff529a378532db139a8ad18cef4ae38d2 /perl_checker.src
parent11ae9e70b66544b37f9c736fb58efd7bc3116461 (diff)
downloadperl_checker-7fcec7e036a842ba24e302279fd6a1b131773931.tar
perl_checker-7fcec7e036a842ba24e302279fd6a1b131773931.tar.gz
perl_checker-7fcec7e036a842ba24e302279fd6a1b131773931.tar.bz2
perl_checker-7fcec7e036a842ba24e302279fd6a1b131773931.tar.xz
perl_checker-7fcec7e036a842ba24e302279fd6a1b131773931.zip
replace warning "unused variable @_" with "if the function doesn't take any
parameters, please use the empty prototype.\nexample \"sub foo() { ... }\""
Diffstat (limited to 'perl_checker.src')
-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)