automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 02/15] [ng] vars: get rid of VAR_SORTED type


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 02/15] [ng] vars: get rid of VAR_SORTED type
Date: Fri, 25 May 2012 13:38:24 +0200

It's basically unused, and the tiny cosmetic enhancements it offers
are not worth the complication of having yet another variable type.

* automake.in (handle_subdirs): Force RECURSIVE_TARGETS to be of
type "VAR_PRETTY" rather than "VAR_SORTED".  This removes the only
actual use of the VAR_SORTED constant.
* lib/Automake/VarDef.pm (VAR_SORTED): Delete.
(@EXPORT, Pod documentation): Adjust accordingly.
* lib/Automake/Variable.pm (output): Don't handle variables of type
VAR_SORTED anymore.
(define): The value of the '$pretty' parameter cannot be VAR_SORTED
anymore.  Adjust internal checks and Pod documentation accordingly.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in              |    2 +-
 lib/Automake/VarDef.pm   |   12 ++++--------
 lib/Automake/Variable.pm |   21 ++++++++-------------
 3 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/automake.in b/automake.in
index d2d1551..8b48cdf 100644
--- a/automake.in
+++ b/automake.in
@@ -3767,7 +3767,7 @@ sub handle_subdirs ()
     if $dsubdirs;
 
   $output_rules .= &file_contents ('subdirs', new Automake::Location);
-  rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
+  rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_PRETTY; # Gross!
 }
 
 
diff --git a/lib/Automake/VarDef.pm b/lib/Automake/VarDef.pm
index dde99ac..0ad705f 100644
--- a/lib/Automake/VarDef.pm
+++ b/lib/Automake/VarDef.pm
@@ -25,7 +25,7 @@ require Exporter;
 use vars '@ISA', '@EXPORT';
 @ISA = qw/Automake::ItemDef Exporter/;
 @EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
-             &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
+             &VAR_ASIS &VAR_PRETTY &VAR_SILENT);
 
 =head1 NAME
 
@@ -91,13 +91,11 @@ use constant VAR_AUTOMAKE => 0; # Variable defined by 
Automake.
 use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac.
 use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am.
 
-=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, C<VAR_SORTED>
+=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>
 
 Possible print styles.  C<VAR_ASIS> variables should be output as-is.
 C<VAR_PRETTY> variables are wrapped on multiple lines if they cannot
-fit on one.  C<VAR_SILENT> variables are not output at all.  Finally,
-C<VAR_SORTED> variables should be sorted and then handled as
-C<VAR_PRETTY> variables.
+fit on one.  C<VAR_SILENT> variables are not output at all.
 
 C<VAR_SILENT> variables can also be overridden silently (unlike the
 other kinds of variables whose overriding may sometimes produce
@@ -110,7 +108,6 @@ use constant VAR_ASIS => 0; # Output as-is.
 use constant VAR_PRETTY => 1;  # Pretty printed on output.
 use constant VAR_SILENT => 2;  # Not output.  (Can also be
                                # overridden silently.)
-use constant VAR_SORTED => 3;  # Sorted and pretty-printed.
 
 =back
 
@@ -141,8 +138,7 @@ C<VAR_AUTOMAKE>, C<VAR_CONFIGURE>, or C<VAR_MAKEFILE> (see 
these
 definitions).
 
 Finally, C<$pretty> tells how the variable should be output, and can
-be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>, or
-C<VAR_SORTED> (see these definitions).
+be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>.
 
 =cut
 
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 7f1643d..f4f0db6 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -542,13 +542,9 @@ sub output ($@)
 
          $res .= $wrap;
        }
-      else # ($def->pretty == VAR_SORTED)
+      else
        {
-         # Suppress escaped new lines.  &makefile_wrap will
-         # add them back, maybe at other places.
-         $val =~ s/\\$//mg;
-         $res .= makefile_wrap ("$str$name $equals", "$str\t",
-                                sort (split (' ' , $val)));
+          prog_error ("unknonw variable type '$def->pretty'");
        }
     }
   return $res;
@@ -727,11 +723,11 @@ assignment.
 
 C<$where>: the C<Location> of the assignment.
 
-C<$pretty>: whether C<$value> should be pretty printed (one of
-C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, or C<VAR_SORTED>, defined
-by by L<Automake::VarDef>).  C<$pretty> applies only to real
-assignments.  I.e., it does not apply to a C<+=> assignment (except
-when part of it is being done as a conditional C<=> assignment).
+C<$pretty>: whether C<$value> should be pretty printed (one of C<VAR_ASIS>,
+C<VAR_PRETTY>, or C<VAR_SILENT>, defined by L<Automake::VarDef>).
+C<$pretty> applies only to real assignments.  I.e., it does not apply to
+a C<+=> assignment (except when part of it is being done as a conditional
+C<=> assignment).
 
 =cut
 
@@ -748,8 +744,7 @@ sub define ($$$$$$$$)
   prog_error "pretty argument missing"
     unless defined $pretty && ($pretty == VAR_ASIS
                               || $pretty == VAR_PRETTY
-                              || $pretty == VAR_SILENT
-                              || $pretty == VAR_SORTED);
+                              || $pretty == VAR_SILENT);
 
   # If there's a comment, make sure it is \n-terminated.
   if ($comment)
-- 
1.7.9.5




reply via email to

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