+2009-03-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ New channel `portability-recursive'.
+ Add new channel for portability warnings about recursive make
+ variable expansions `$(var1$(var2))'. Enable it alongside
+ `-Wportability'.
+ * lib/Automake/ChannelDefs.pm (Automake::ChannelDefs): Register
+ channel `portability-recursive'.
+ * lib/Automake/Variable.pm (_VARIABLE_CHARACTERS)
+ (_VARIABLE_RECURSIVE_PATTERN): New variables.
+ (check_variable_expansions): Diagnose recursive variable
+ expansions through the new channel.
+
2009-03-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Improve NetBSD 'make -n' output for many standard targets.
-# Copyright (C) 2002, 2003, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 2008, 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
register_channel 'obsolete', type => 'warning', silent => 1;
register_channel 'override', type => 'warning', silent => 1;
register_channel 'portability', type => 'warning', silent => 1;
+register_channel 'portability-recursive', type => 'warning', silent => 1;
register_channel 'syntax', type => 'warning';
register_channel 'unsupported', type => 'warning';
-# Copyright (C) 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-my $_VARIABLE_PATTERN = '^[.A-Za-z0-9_@]+' . "\$";
+my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@]+';
+my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$";
+my $_VARIABLE_RECURSIVE_PATTERN =
+ '^([.A-Za-z0-9_@]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$";
# The order in which variables should be output. (May contain
# duplicates -- only the first occurrence matters.)
# Mention this in the diagnostic.
my $gnuext = "";
$gnuext = "\n(probably a GNU make extension)" if $var =~ / /;
- msg ('portability', $where,
- "$var: non-POSIX variable name$gnuext");
+ # Accept recursive variable expansions if so desired
+ # (we hope they are rather portable in practice).
+ if ($var =~ /$_VARIABLE_RECURSIVE_PATTERN/o)
+ {
+ msg ('portability-recursive', $where,
+ "$var: non-POSIX recursive variable expansion$gnuext");
+ }
+ else
+ {
+ msg ('portability', $where, "$var: non-POSIX variable name$gnuext");
+ }
}
}
}