[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14441: [PATCH 3/8] suffix rules: better distinction between builtin
From: |
Stefano Lattarini |
Subject: |
bug#14441: [PATCH 3/8] suffix rules: better distinction between builtin and user-derived |
Date: |
Tue, 28 May 2013 11:45:35 +0200 |
Fixes automake bug#14441.
* lib/Automake/Rule.pm ($_suffix_rules_default): Remove, superseded by ...
(%suffix_rules_builtin): ... this lexical variable.
($suffix_rules): Remove, superseded by ...
(%suffix_rules): ... this lexical variable.
(suffix_rules, suffix_rules_count): Adjust.
(register_suffix_rule): Update '%suffix_rules_builtin' rather than
'%suffix_rules' if the location (as passed by the '$where' argument)
is an "internal" one (doesn't come from user-provided Makefile.am).
(reset): Simplify resetting of '%suffix_rules' to the default ones
accordingly.
* t/list-of-tests.mk (XFAIL_TESTS): Drop test 'suffix-custom-pr14441.sh'.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/Automake/Rule.pm | 31 ++++++++++++-------------------
t/list-of-tests.mk | 1 -
2 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index 5f6f3a2..ed1fa24 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -101,10 +101,6 @@ my $_SUFFIX_RULE_PATTERN =
# Suffixes found during a run.
use vars '@_suffixes';
-# Same as $suffix_rules (declared below), but records only the
-# default rules supplied by the languages Automake supports.
-use vars '$_suffix_rules_default';
-
=item C<%dependencies>
Holds the dependencies of targets which dependencies are factored.
@@ -154,7 +150,11 @@ C<register_suffix_rule> function.
=cut
-my $suffix_rules;
+my %suffix_rules;
+
+# Same as $suffix_rules, but records only the default rules
+# supplied by the languages Automake supports.
+my %suffix_rules_builtin;
=item C<$KNOWN_EXTENSIONS_PATTERN>
@@ -317,16 +317,7 @@ sub reset()
{
%_rule_dict = ();
@_suffixes = ();
- # The first time we initialize the variables,
- # we save the value of $suffix_rules.
- if (defined $_suffix_rules_default)
- {
- $suffix_rules = $_suffix_rules_default;
- }
- else
- {
- $_suffix_rules_default = $suffix_rules;
- }
+ %suffix_rules = %suffix_rules_builtin;
%dependencies =
(
@@ -393,9 +384,9 @@ XXX
sub suffix_rule ($$)
{
my ($source_ext, $obj) = @_;
- return undef unless (exists $suffix_rules->{$source_ext} and
- exists $suffix_rules->{$source_ext}{$obj});
- return $suffix_rules->{$source_ext}{$obj}[0];
+ return undef unless (exists $suffix_rules{$source_ext} and
+ exists $suffix_rules{$source_ext}{$obj});
+ return $suffix_rules{$source_ext}{$obj}[0];
}
=item C<register_suffix_rule ($where, $src, $dest)>
@@ -410,6 +401,8 @@ This upgrades the C<$suffix_rules> variables.
sub register_suffix_rule ($$$)
{
my ($where, $src, $dest) = @_;
+ my $suffix_rules = $where->{'position'} ? \%suffix_rules
+ : \%suffix_rules_builtin;
verb "Sources ending in $src become $dest";
push @_suffixes, $src, $dest;
@@ -487,7 +480,7 @@ F<Makefile> (excluding predefined suffix rules).
sub suffix_rules_count ()
{
- return (scalar keys %$suffix_rules) - (scalar keys %$_suffix_rules_default);
+ return (scalar keys %suffix_rules) - (scalar keys %suffix_rules_builtin);
}
=item C<@list = suffixes>
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 8407cf8..fb2e444 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -41,7 +41,6 @@ t/remake-timing-bug-pr8365.sh \
t/lex-subobj-nodep.sh \
t/remake-am-pr10111.sh \
t/remake-m4-pr10111.sh \
-t/suffix-custom-pr14441.sh \
$(perl_fake_XFAIL_TESTS)
perl_TESTS = \
--
1.8.3.rc3.8.g5e49f30
- bug#14441: bug in new file extensions, Felix Salfelder, 2013/05/22
- bug#14441: bug in new file extensions, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 0/8] Fix automake bug#14441, and related minor refactorings, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 3/8] suffix rules: better distinction between builtin and user-derived,
Stefano Lattarini <=
- bug#14441: [PATCH 1/8] tests: expose automake bug#14441, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 2/8] Automake::Rule: expose suffix rules as a function, not a scalar, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 4/8] Automake::Rule: make private variables lexically scoped, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 6/8] Automake::Rule: rename: suffix_rule() -> next_in_suffix_chain(), Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 5/8] Automake::Rule: adjust comments and POD according to previous changes, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 8/8] NEWS: document fix for bug#14441, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 7/8] Automake::Rule: consistently prepend underscore to private variables, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 0/8] Fix automake bug#14441, and related minor refactorings, Stefano Lattarini, 2013/05/29
- Message not available