summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/global_checks.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-19 21:22:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-19 21:22:16 +0000
commit201b4a45aaaff3df603e324f21a5285ae103e4ab (patch)
tree9962f130b983e700444be7da3379100bfee07f08 /perl_checker.src/global_checks.ml
parent91a49a49d0b6a7713e644a79412fd5307d7cb335 (diff)
downloadperl_checker-201b4a45aaaff3df603e324f21a5285ae103e4ab.tar
perl_checker-201b4a45aaaff3df603e324f21a5285ae103e4ab.tar.gz
perl_checker-201b4a45aaaff3df603e324f21a5285ae103e4ab.tar.bz2
perl_checker-201b4a45aaaff3df603e324f21a5285ae103e4ab.tar.xz
perl_checker-201b4a45aaaff3df603e324f21a5285ae103e4ab.zip
various
Diffstat (limited to 'perl_checker.src/global_checks.ml')
-rw-r--r--perl_checker.src/global_checks.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/perl_checker.src/global_checks.ml b/perl_checker.src/global_checks.ml
index 727d3ed..086d633 100644
--- a/perl_checker.src/global_checks.ml
+++ b/perl_checker.src/global_checks.ml
@@ -143,7 +143,7 @@ let is_global_var context ident =
| "last" | "lc" | "lcfirst" | "length" | "link" | "localtime" | "log" | "lstat"
| "map" | "mkdir" | "next" | "no" | "oct" | "open" | "opendir" | "ord"
| "pack" | "pipe" | "pop" | "print" | "printf" | "push" | "quotemeta"
- | "rand" | "read" | "readdir" | "readlink" | "redo" | "ref" | "rename" | "require" | "return" | "reverse" | "rmdir"
+ | "rand" | "read" | "readdir" | "readlink" | "redo" | "ref" | "rename" | "require" | "return" | "reverse" | "rindex" | "rmdir"
| "scalar" | "seek" | "select" | "setpwent" | "shift" | "sleep" | "sort" | "splice" | "split" | "sprintf" | "stat" | "substr"
| "symlink" | "syscall" | "sysopen" | "sysread" | "sysseek" | "system" | "syswrite" | "tie" | "time"
| "uc" | "ucfirst" | "umask" | "undef" | "unlink" | "unpack" | "unshift" | "utime" | "values" | "vec" | "waitpid" | "wantarray" | "warn" | "write"
@@ -366,9 +366,9 @@ let add_package_to_state state package =
Hashtbl.replace state.per_package package.package_name package
let check_unused_vars package =
- Hashtbl.iter (fun v (pos, is_used) ->
- if not !is_used then
- warn_with_pos pos (sprintf "unused function %s::%s" package.package_name (variable2s v))
+ Hashtbl.iter (fun (context, name) (pos, is_used) ->
+ if not (!is_used || List.mem name ["BEGIN"; "END"; "DESTROY"; "ISA"; "AUTOLOAD"; "EXPORT"; "EXPORT_OK"; "EXPORT_TAGS"]) then
+ warn_with_pos pos (sprintf "unused %s%s::%s" (if context = I_func then "function " else "variable " ^ context2s context) package.package_name name)
) package.vars_declared
let arrange_global_vars_declared state =