]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] rule: get rid of $KNOWN_EXTENSIONS_PATTERN
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 23 May 2012 11:31:15 +0000 (13:31 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 24 May 2012 07:35:29 +0000 (09:35 +0200)
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 <stefano.lattarini@gmail.com>
automake.in
lib/Automake/Rule.pm

index 7b0ac7a42203349fdd1fae89cc02b720c8bf56f9..72c6d36464b4cad14398165a0d91dd72fca71e91 100644 (file)
@@ -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})
     {
index c8b8111490f305f704e4430490b3c229a977eba0..e3fd69aee4cf3f28d1b6012608830e4b16374e95 100644 (file)
@@ -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<register_suffix_rule> 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<accept_extensions>.
-
-=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<accept_extensions (@exts)>
-
-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<rules>
 
 Return the list of all L<Automake::Rule> 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);
         }
     }