pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Even if the type of a variabl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/52de69a5a0fb
branches:  trunk
changeset: 508029:52de69a5a0fb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Feb 13 15:20:22 2006 +0000

description:
- Even if the type of a variable is guessed based on its name, report it
  as untyped when in --debug mode. This allows the --debug mode to be used
  for detecting spelling mistakes.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 9d966ef8fd91 -r 52de69a5a0fb pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Feb 13 15:19:01 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Feb 13 15:20:22 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.512 2006/02/12 12:10:13 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.513 2006/02/13 15:20:22 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -3100,7 +3100,7 @@
 
 sub checkline_mk_vartype($$$$$) {
        my ($line, $varname, $op, $value, $comment) = @_;
-       my ($vartypes);
+       my ($vartypes, $guessed);
 
        return unless $opt_warn_types;
 
@@ -3116,6 +3116,7 @@
                        }
                }
 
+               $guessed = false;
                if (!defined($type)) {
                        # Guess the datatype of the variable based on
                        # naming conventions.
@@ -3133,11 +3134,12 @@
                        if (defined($type)) {
                                $line->log_info("The guessed type of ${varname} is \"${type}\".");
                        }
+                       $guessed = true;
                }
 
-               if (!defined($type)) {
+               if (!defined($type) || $guessed) {
                        if ($varname !~ qr"_MK$") {
-                               $opt_debug and $line->log_warning("[checkline_mk_vartype] Unchecked variable ${varname}.");
+                               $opt_debug and $line->log_warning("[checkline_mk_vartype] Untyped variable ${varname}.");
                        }
 
                } elsif ($op eq "!=") {



Home | Main Index | Thread Index | Old Index