pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Unnecessary .undef directives i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d22ed3234feb
branches:  trunk
changeset: 503944:d22ed3234feb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Dec 02 08:26:52 2005 +0000

description:
Unnecessary .undef directives in Makefiles can be fixed automatically if
all mentioned variables have been used in .for loops before.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 9ba033d178a0 -r d22ed3234feb pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Dec 02 08:14:53 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Dec 02 08:26:52 2005 +0000
@@ -11,7 +11,7 @@
 # Freely redistributable.  Absolutely no warranty.
 #
 # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.408 2005/12/02 08:08:36 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.409 2005/12/02 08:26:52 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -2752,11 +2752,17 @@
                                }
 
                        } elsif ($directive eq "undef" && defined($args)) {
+                               my $all_unnecessary = true;
                                foreach my $var (split(qr"\s+", $args)) {
                                        if (exists($for_variables->{$var})) {
                                                $line->log_note("Using \".undef\" after a \".for\" loop is unnecessary.");
+                                       } else {
+                                               $all_unnecessary = false;
                                        }
                                }
+                               if ($all_unnecessary) {
+                                       $line->delete();
+                               }
                        }
 
                } elsif ($text =~ regex_mk_dependency) {



Home | Main Index | Thread Index | Old Index