summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2008-01-10 03:33:46 +0000
committerrillig <rillig@pkgsrc.org>2008-01-10 03:33:46 +0000
commitae2d8788af0397e1945a24362338ca70926e8bd3 (patch)
tree87f375a5e57ead2fb08d3905525470d1bd1ed680 /pkgtools/pkglint
parente874c5ae78dc10d491bbf89bd36d07bf828600c4 (diff)
downloadpkgsrc-ae2d8788af0397e1945a24362338ca70926e8bd3.tar.gz
Check misspelled macro names, for example __NetBSD_Version instead of
__NetBSD_Version__. Inspired by emulators/wine/patches/patch-ac 1.37.
Diffstat (limited to 'pkgtools/pkglint')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index b76f7fe8538..438e6c5e2fc 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -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 @@ sub checkline_cpp_macro_names($$) {
"__svr4__" => "__SVR4",
};
+ use constant spellcheck_macros => {
+ "__NetBSD_Version" => "__NetBSD_Version__",
+ };
+
$rest = $text;
while ($rest =~ s/defined\((__[\w_]+)\)//) {
my ($macro) = ($1);
@@ -4028,6 +4032,9 @@ sub checkline_cpp_macro_names($$) {
} 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}\".");
}