automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 2/5] [ng] rule: get rid of $KNOWN_EXTENSIONS_PATTER


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 2/5] [ng] rule: get rid of $KNOWN_EXTENSIONS_PATTERN
Date: Thu, 24 May 2012 09:42:00 +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 <address@hidden>
---
 automake.in          |    7 +++----
 lib/Automake/Rule.pm |   33 +--------------------------------
 2 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/automake.in b/automake.in
index 7b0ac7a..72c6d36 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 c8b8111..e3fd69a 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<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 = "";
address@hidden = ();
-
 =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);
         }
     }
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]