diff options
author | rillig <rillig> | 2008-11-04 22:27:00 +0000 |
---|---|---|
committer | rillig <rillig> | 2008-11-04 22:27:00 +0000 |
commit | 77cf91347740c78899e3156da7d719b86f9465e0 (patch) | |
tree | f416cb971c3d9954a11c986327cff860e140f455 /pkgtools | |
parent | 386ad06b07d8976cf4d1de43088067619e720440 (diff) | |
download | pkgsrc-77cf91347740c78899e3156da7d719b86f9465e0.tar.gz |
The macro __NetBSD_Prereq__ should not be used.
Extended the spell checker for variants of __NetBSD_Version__.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index dd65e94bcfb..1ba57ce470f 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.780 2008/11/04 21:45:13 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.781 2008/11/04 22:27:00 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -3759,12 +3759,8 @@ sub checkline_cpp_macro_names($$) { "__svr4__" => "__SVR4", }; - use constant spellcheck_macros => { - "__NetBSD_Version" => "__NetBSD_Version__", - }; - $rest = $text; - while ($rest =~ s/defined\((__[\w_]+)\)//) { + while ($rest =~ s/defined\((__[\w_]+)\)// || $rest =~ s/\b(_\w+)\(//) { my ($macro) = ($1); if (exists(good_macros->{$macro})) { @@ -3773,8 +3769,17 @@ sub checkline_cpp_macro_names($$) { $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}."\"."); + } elsif ($macro eq "__NetBSD_Prereq__") { + $line->log_warning("Please use __NetBSD_Version__ instead of __NetBSD_Prereq__."); + $line->explain_warning( +"The __NetBSD_Prereq__ macro is pretty new. It was born in NetBSD", +"4.99.3, and maybe it won't survive for long. A better (and compatible)", +"way is to compare __NetBSD_Version__ directly to the required version", +"number."); + + } elsif ($macro =~ m"^_+NetBSD_+Version_+$"i && $macro ne "__NetBSD_Version__") { + $line->log_warning("Misspelled variant \"${macro}\" of \"__NetBSD_Version__\"."); + } else { $opt_debug_unchecked and $line->log_debug("Unchecked macro \"${macro}\"."); } |