From 15534af1cf51ab8d9bfcd1effddb84f04094b8ff Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 23 May 2012 13:31:15 +0200 Subject: [PATCH] [ng] rule: get rid of $KNOWN_EXTENSIONS_PATTERN Another removal of some Automake-time processing. * automake.in (handle_single_transform): When breaking up the path of a source file into (directory, base, extension) components, accept any "dotted" extensions (e.g., '.c' and '.y', but also '.foo' and '._'), not just the extensions once registered in $KNOWN_EXTENSIONS_PATTERN. (register_language): Don't call '&accept_extensions' anymore on the extensions of the language being processed (e.g., '.c' for the C language, and '.cc', '.c++', '.cxx' and '.cpp' for the C++ language); that was done only so that $KNOWN_EXTENSIONS_PATTERN could be properly updated, and that variable is obsolete now. * lib/Automake/Rule.pm (accept_extensions, $KNOWN_EXTENSIONS_PATTERN): Delete these exported subroutine and variable, and their documentation. (@EXPORT): Update not to export them anymore. (@_known_extensions_list): Remove this internal variable. (define): Don't call '&accept_extensions' anymore on the source suffix; that was done only so that $KNOWN_EXTENSIONS_PATTERN could be properly updated, and that variable is obsolete now. Signed-off-by: Stefano Lattarini --- automake.in | 7 +++---- lib/Automake/Rule.pm | 33 +-------------------------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/automake.in b/automake.in index 7b0ac7a42..72c6d3646 100644 --- a/automake.in +++ b/automake.in @@ -1662,7 +1662,9 @@ sub handle_single_transform ($$$$$%) # is in effect. # Split file name into base and extension. - next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; + next if ! /^(?:(.*)\/)?([^\/]*?)(\.[^.]+)$/; + prog_error ("source file '$_' missing dotted extension") + unless defined $2 and defined $3; my $full = $_; my $directory = $1 || ''; my $base = $2; @@ -5855,9 +5857,6 @@ sub register_language (%) } } - # Update the pattern of known extensions. - accept_extensions (@{$lang->extensions}); - # Upate the $suffix_rule map. foreach my $suffix (@{$lang->extensions}) { diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index c8b811149..e3fd69aee 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -30,9 +30,8 @@ require Exporter; use vars '@ISA', '@EXPORT', '@EXPORT_OK'; @ISA = qw/Automake::Item Exporter/; @EXPORT = qw (reset register_suffix_rule suffix_rules_count - rules $suffix_rules $KNOWN_EXTENSIONS_PATTERN + rules $suffix_rules depend %dependencies %actions register_action - accept_extensions reject_rule msg_rule msg_cond_rule err_rule err_cond_rule rule rrule ruledef rruledef); @@ -150,21 +149,6 @@ C function. use vars '$suffix_rules'; -=item C<$KNOWN_EXTENSIONS_PATTERN> - -Pattern that matches all know input extensions (i.e. extensions used -by the languages supported by Automake). Using this pattern (instead -of '\..*$') to match extensions allows Automake to support dot-less -extensions. - -New extensions should be registered with C. - -=cut - -use vars qw ($KNOWN_EXTENSIONS_PATTERN @_known_extensions_list); -$KNOWN_EXTENSIONS_PATTERN = ""; -@_known_extensions_list = (); - =back =head2 Error reporting functions @@ -251,20 +235,6 @@ sub reject_rule ($$) =over 4 -=item C - -Update C<$KNOWN_EXTENSIONS_PATTERN> to recognize the extensions -listed in C<@exts>. Extensions should contain a dot if needed. - -=cut - -sub accept_extensions (@) -{ - push @_known_extensions_list, @_; - $KNOWN_EXTENSIONS_PATTERN = - '(?:' . join ('|', map (quotemeta, @_known_extensions_list)) . ')'; -} - =item C Return the list of all L instances. (I.e., all @@ -802,7 +772,6 @@ sub define ($$$$$;$) if ($deps =~ /^\s*%(\.$chars_rx)(\s|$)/o) { my $srcsuf = $1; - accept_extensions ($srcsuf); register_suffix_rule ($where, $srcsuf, $objsuf); } } -- 2.47.2