summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-04-12 08:23:49 +0000
committerrillig <rillig@pkgsrc.org>2006-04-12 08:23:49 +0000
commit554064de83a68fae3037eb0989a1f33510aa805b (patch)
tree30812779914d169b67ebd30a5ac5b44a74e884cd /pkgtools
parentb3b10936939b47cc8e96bd21b9cb53fe92f2f332 (diff)
downloadpkgsrc-554064de83a68fae3037eb0989a1f33510aa805b.tar.gz
Some variables, like WRKSRC, PREFIX, LOCALBASE and *DIR don't need the :Q
operator, since we expect them to never contain special characters. This change reduces the number of -Wall warnings by approximately 28000.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index eb0c48e40f8..fe231fb2c64 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.550 2006/04/11 17:44:29 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.551 2006/04/12 08:23:49 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -2067,6 +2067,12 @@ sub type_should_be_quoted($) {
return !($type =~ qr"^(?:List.*|ShellCommand|SedCommands)$");
}
+sub variable_needs_quoting($) {
+ my ($varname) = @_;
+
+ return !($varname =~ qr"^(?:.*DIR|DISTNAME|LOCALBASE|PKGNAME|PREFIX|WRKSRC)$");
+}
+
my $check_pkglint_version_done = false;
sub check_pkglint_version() {
@@ -2461,7 +2467,7 @@ sub checkline_mk_shellword($$$) {
if (exists(get_vartypes_map()->{$varname}) && !(defined($mod) && $mod =~ qr":Q$")) {
my $vartype = get_vartypes_map()->{$varname};
- if (type_should_be_quoted($vartype)) {
+ if (variable_needs_quoting($varname) && type_should_be_quoted($vartype)) {
$line->log_warning("[experimental] Please use \${${varname}:Q} instead of \${${varname}}.");
}
} elsif (exists(get_varname_to_toolname()->{$varname})) {
@@ -2546,7 +2552,10 @@ sub checkline_mk_shellword($$$) {
"appropriate to remove the double quotes.");
} elsif ($opt_warn_quoting) {
- if ($state == SWST_PLAIN) {
+ if (!variable_needs_quoting($varname)) {
+ # These variables don't need to be quoted.
+
+ } elsif ($state == SWST_PLAIN) {
$line->log_warning("Please use \${${varname}:Q} instead of \${${varname}}.");
$line->replace("\${${varname}}", "\${${varname}:Q}");
} else {