From 6a80c801ebb9b41fed0dcf4a5973432e75a868f4 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 23 Mar 2001 17:06:39 +0000 Subject: [PATCH] * automake.in (¯o_define): Don't lose the location if we redefine a variable. Don't push all the variables in @var_list, let... (&read_am_file, &file_contents): ... do it. (&define_pretty_variable): Use macro_define. (&am_install_var): Delete the value of variables being redefined to pacify ¯o_define which checks that variables are not doubly defined. --- ChangeLog | 11 +++++++++++ automake.in | 17 ++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9810a6e2..d1a04954 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-03-23 Akim Demaille + + * automake.in (¯o_define): Don't lose the location if we + redefine a variable. + Don't push all the variables in @var_list, let... + (&read_am_file, &file_contents): ... do it. + (&define_pretty_variable): Use macro_define. + (&am_install_var): Delete the value of variables being redefined + to pacify ¯o_define which checks that variables are not + doubly defined. + 2001-03-23 Akim Demaille * automake.in (&conditional_dump): Rename as... diff --git a/automake.in b/automake.in index c17e68fc..293949e3 100755 --- a/automake.in +++ b/automake.in @@ -5655,7 +5655,11 @@ sub macro_define ($$$$$$) # The first assignment to a macro sets the line number. Ideally # I suppose we would associate line numbers with random bits of # text. - $content_lines{$var} = $where; + # FIXME: We sometimes redefine some variables, but we want to keep + # the original location. More subs are needed to handle properly + # variables. Once this done, remove this hack. + $content_lines{$var} = $where + unless defined $content_lines{$var}; # If first assignment, set `+=' indicator. $var_was_plus_eq{$var} = $type eq '+' && ! $var_is_am{$var}; @@ -5712,7 +5716,6 @@ sub macro_define ($$$$$$) # FIXME: I don't understand what's so special wrt `:', nor # why we forget the `+' nature of a var. $def_type{$var} = ($type eq ':') ? ':' : ''; - push (@var_list, $var); } @@ -6203,14 +6206,11 @@ sub define_variable sub define_pretty_variable { my ($var, $cond, @value) = @_; + if (! defined $contents{$var} || ($cond && ! &variable_defined ($var, $cond))) { - $contents{$var} = join (' ', @value); - if ($cond) - { - ${$conditional{$var}}{$cond} = $contents{$var}; - } + macro_define ($var, 0, '', $cond, join (' ', @value), undef); my $make_condition = &make_condition ($cond); &pretty_print ($make_condition . $var . ' =', $make_condition, @value); @@ -6502,6 +6502,7 @@ sub read_am_file macro_define ($last_var_name, 0, $type, conditional_string (@conditional_stack), $value, $.); + push (@var_list, $last_var_name); # FIXME: this doesn't always work correctly; it will group # all comments for a given variable, no matter where @@ -6884,6 +6885,7 @@ sub file_contents ($%) # Accumulating variables must not be output. macro_define ($var, 1, $type, $cond_string, $val, $.); + push (@var_list, $var); # If the user has set some variables we were in charge # of (which is detected by the first reading of @@ -7170,6 +7172,7 @@ sub am_install_var { my $cond = shift (@condvals); my @val = split (' ', shift (@condvals)); + delete $conditional{$one_name}{$cond}; &define_pretty_variable ($one_name, $cond, @val); } } -- 2.43.5