pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Check misspelled macro names, f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2129332c40e6
branches:  trunk
changeset: 537511:2129332c40e6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Jan 10 03:33:46 2008 +0000

description:
Check misspelled macro names, for example __NetBSD_Version instead of
__NetBSD_Version__. Inspired by emulators/wine/patches/patch-ac 1.37.

diffstat:

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

diffs (31 lines):

diff -r 97f4717665ba -r 2129332c40e6 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Jan 10 02:34:09 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Jan 10 03:33:46 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.755 2008/01/06 14:55:00 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.756 2008/01/10 03:33:46 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4019,6 +4019,10 @@
                "__svr4__" => "__SVR4",
        };
 
+       use constant spellcheck_macros => {
+               "__NetBSD_Version" => "__NetBSD_Version__",
+       };
+
        $rest = $text;
        while ($rest =~ s/defined\((__[\w_]+)\)//) {
                my ($macro) = ($1);
@@ -4028,6 +4032,9 @@
                } elsif (exists(bad_macros->{$macro})) {
                        $line->log_warning("The macro \"${macro}\" is not portable enough. Please use \"".bad_macros->{$macro}."\" instead.");
                        $line->explain_warning("See the pkgsrc guide, section \"CPP defines\" for details.");
+
+               } elsif (exists(spellcheck_macros->{$macro})) {
+                       $line->log_warning("Misspelled variant \"${macro}\" of \"".spellcheck_macros->{$macro}."\".");
                } else {
                        $opt_debug_unchecked and $line->log_debug("Unchecked macro \"${macro}\".");
                }



Home | Main Index | Thread Index | Old Index