automake
[Top][All Lists]
Advanced

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

32-simplify-contents-traces.patch


From: Akim Demaille
Subject: 32-simplify-contents-traces.patch
Date: Sun, 11 Mar 2001 19:08:40 +0100

Index: 0.162/ChangeLog
--- 0.162/ChangeLog Sat, 10 Mar 2001 17:45:55 +0100 akim (am/f/47_ChangeLog 
1.146 644)
+++ 0.163(w)/ChangeLog Sat, 10 Mar 2001 18:20:38 +0100 akim (am/f/47_ChangeLog 
1.147 644)
@@ -1,5 +1,15 @@
 2001-03-10  Akim Demaille  <address@hidden>

+       * automake.in (&variable_defined, &define_pretty_variable):
+       Simplify code which used to handle the cases where not all
+       variables were in %conditional.
+       (&define_variable): Use &define_pretty_variable.
+       (&variable_conditions_sub, &variable_value_as_list_worker)
+       (&variable_value_as_list, &rule_define): Simplify syntax.
+       (&read_main_am_file): Dump the guilty predefined variables.
+
+2001-03-10  Akim Demaille  <address@hidden>
+
        * automake.in (&variable_conditions_sub)
        (&variable_value_as_list_worker): Remove dead code which used to
        handle the cases where not all variables were in %conditional.
Index: 0.162/automake.in
--- 0.162/automake.in Sat, 10 Mar 2001 17:45:55 +0100 akim (am/f/39_automake.i 
1.150 755)
+++ 0.163(w)/automake.in Sat, 10 Mar 2001 18:17:16 +0100 akim 
(am/f/39_automake.i 1.151 755)
@@ -5692,25 +5691,21 @@
 {
     my ($var, $cond) = @_;

-    if (exists $conditional{$var} && !$var_is_am{$var})
+    $cond ||= 'TRUE';
+
+    if (!$var_is_am{$var})
     {
-       if ($cond && $conditional{$var})
+      if (!exists $conditional{$var}{$cond})
        {
-         if (exists $conditional{$var}{$cond})
-           {
-             # Even a conditional examination is good enough for us.
-             # FIXME: really should maintain examined status on a
-             # per-condition basis.
-             $content_seen{$var} = 1;
-             return 1;
-           }
-
-           # The variable is not defined for the given condition.
-           return 0;
+         # The variable is not defined for the given condition.
+         return 0;
        }

-       $content_seen{$var} = 1;
-       return 1;
+      # Even a conditional examination is good enough for us.  FIXME:
+      # really should maintain examined status on a per-condition
+      # basis.
+      $content_seen{$var} = 1;
+      return 1;
     }

     &am_line_error ($var, "`$var' is a target; expected a variable")
@@ -5804,7 +5799,7 @@

        push (@parent_conds, $vcond);
        my @subvar_conds = ();
-       foreach (split (' ', ${$conditional{$var}}{$vcond}))
+       foreach (split (' ', $conditional{$var}{$vcond}))
        {
            # If a comment seen, just leave.
            last if /^#/;
@@ -6073,7 +6068,7 @@
        $vars_scanned{$var} = 1;
        foreach my $vcond (keys %{$conditional{$var}})
        {
-           my $val = ${$conditional{$var}}{$vcond};
+           my $val = $conditional{$var}{$vcond};
            push (@result, &value_to_list ($var, $val, $cond));
        }
     }
@@ -6084,7 +6079,7 @@
        my $onceflag;
        foreach my $vcond (keys %{$conditional{$var}})
        {
-           my $val = ${$conditional{$var}}{$vcond};
+           my $val = $conditional{$var}{$vcond};
            if (&conditional_true_when ($vcond, $cond))
            {
                # Warn if we have an ambiguity.  It's hard to know how
@@ -6115,25 +6110,6 @@
 }


-# define_variable ($VAR, $VALUE)
-# ------------------------------
-# Define a new user variable VAR to VALUE, but only if not already defined.
-sub define_variable
-{
-    my ($var, $value) = @_;
-    if (! defined $conditional{$var}{'TRUE'})
-    {
-       $output_vars .= $var . ' = ' . $value . "\n";
-       variable_define ($var, 0, '', '', $value, undef);
-       $content_seen{$var} = 1;
-    }
-    elsif ($var_was_plus_eq{$var})
-    {
-       &am_line_error ($var,
-                       "internally generated variable `$var' was set with 
`+='");
-    }
-}
-
 # Like define_variable, but the value is a list, and the variable may
 # be defined conditionally.  The second argument is the conditional
 # under which the value should be defined; this should be the empty
@@ -6144,8 +6120,7 @@
 {
     my ($var, $cond, @value) = @_;

-    if (! defined $conditional{$var}{'TRUE'}
-       || ($cond && ! &variable_defined ($var, $cond)))
+    if (! &variable_defined ($var, $cond))
     {
         variable_define ($var, 0, '', $cond, join (' ', @value), undef);
         my $make_condition = &make_condition ($cond);
@@ -6153,8 +6128,25 @@
                       $make_condition, @value);
        $content_seen{$var} = 1;
     }
+    elsif ($var_was_plus_eq{$var})
+    {
+       &am_line_error ($var,
+                       "internally generated variable `$var' was set with 
`+='");
+    }
+}
+
+
+# define_variable ($VAR, $VALUE)
+# ------------------------------
+# Define a new user variable VAR to VALUE, but only if not already defined.
+sub define_variable
+{
+    my ($var, $value) = @_;
+
+    define_pretty_variable ($var, 'TRUE', $value);
 }

+
 # Like define_variable, but define a variable to be the configure
 # substitution by the same name.
 sub define_configure_variable
@@ -6236,7 +6228,7 @@
        {
          &check_ambiguous_conditional ($target, $cond);
        }
-      ${$target_conditional{$target}}{$cond} = $where;
+      $target_conditional{$target}{$cond} = $where;
     }


@@ -6530,8 +6522,11 @@
     my ($amfile) = @_;

     # This supports the strange variable tricks we are about to play.
-    &prog_error ("variable defined before read_main_am_file")
-        if scalar keys %conditional > 0;
+    if (scalar keys %conditional > 0)
+      {
+       variables_dump ();
+       &prog_error ("variable defined before read_main_am_file");
+      }

     # We want to predefine as many variables as possible.  This lets
     # the user set them with `+=' in Makefile.am.  However, we don't



reply via email to

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