summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl_checker.src/global_checks.ml8
-rw-r--r--perl_checker_fake_packages/Gtk2.pm10
2 files changed, 12 insertions, 6 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 =
diff --git a/perl_checker_fake_packages/Gtk2.pm b/perl_checker_fake_packages/Gtk2.pm
index 4d5ebb4..89f3021 100644
--- a/perl_checker_fake_packages/Gtk2.pm
+++ b/perl_checker_fake_packages/Gtk2.pm
@@ -2,7 +2,9 @@ package Gtk2;
our @ISA = qw();
+sub Gtk2::x {}
sub action_area {}
+sub active {}
sub add_accel_group {}
sub add_events {}
sub add_with_viewport {}
@@ -51,6 +53,7 @@ sub get_iter_at_offset {}
sub get_language {}
sub get_metrics {}
sub get_modal {}
+sub get_origin {}
sub get_pango_context {}
sub get_parent {}
sub get_path {}
@@ -96,6 +99,7 @@ sub set_col_spacings {}
sub set_cursor {}
sub set_cursor_visible {}
sub set_editable {}
+sub set_events {}
sub set_filename {}
sub set_focus_vadjustment {}
sub set_headers_visible {}
@@ -139,13 +143,14 @@ sub unref {}
sub values {}
sub vbox {}
sub white_gc {}
-sub width {}
sub widget {}
+sub width {}
sub window {}
sub window_position {}
-sub Gtk2::x {}
+sub y {} ;#;
sub bootstrap {}
+sub exit {}
sub init {}
sub main {}
sub main_quit {}
@@ -155,3 +160,4 @@ sub timeout_add {}
sub timeout_remove {}
sub update {}
sub update_ui {}
+