[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17-file-contents-uses-variable-define.patch
From: |
Akim Demaille |
Subject: |
17-file-contents-uses-variable-define.patch |
Date: |
Fri, 09 Mar 2001 00:47:59 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* automake.in (&variable_define): Don't rely on $1.
Initialize the variable.
Set its Automakism only if not defined or if given to the user.
When concatenating values, insert a separator only if the value
was not empty.
(&read_am_file): When dumping the @var_list, skip Automake
variables.
(&file_contents): Use variable_define.
Index: automake.in
--- automake.in Thu, 08 Mar 2001 23:07:04 +0100 akim (am/f/39_automake.i 1.130
755)
+++ automake.in Thu, 08 Mar 2001 23:30:07 +0100 akim (am/f/39_automake.i 1.130
755)
@@ -5611,31 +5611,38 @@ sub check_ambiguous_conditional ($$)
# &variable_define($VAR, $VAR_IS_AM, $TYPE, @COND_STRING, $VALUE, $WHERE)
# ----------------------------------------------------------------------
+# The $VAR can go from Automake to user, but not the converse.
sub variable_define ($$$$$$)
{
my ($var, $var_is_am, $type, $cond_string, $value, $where) = @_;
- if (defined $contents{$1}
+ if (defined $contents{$var}
&& ($cond_string
- ? ! defined $conditional{$1}
- : defined $conditional{$1}))
+ ? ! defined $conditional{$var}
+ : defined $conditional{$var}))
{
- &am_line_error ($1,
- "$1 defined both conditionally and unconditionally");
+ &am_line_error ($var,
+ "$var defined both conditionally and unconditionally");
}
if (! defined $contents{$var})
{
- # The first assignment to a macro sets the line
- # number. Ideally I suppose we would associate line
- # numbers with random bits of text.
+ # Initialize: we rely on defined.
+ $contents{$var} = '';
+
+ # 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;
# If first assignment, set `+=' indicator.
$var_was_plus_eq{$var} = $type eq '+' && ! $var_is_am{$var};
}
- $var_is_am{$var} = $var_is_am;
+ if (! defined $var_is_am{$var} || !$var_is_am)
+ {
+ $var_is_am{$var} = $var_is_am;
+ }
# Handled unconditional macros.
if ($type eq '+')
@@ -5645,7 +5652,7 @@ sub variable_define ($$$$$$)
# Insert a backslash before a trailing newline.
$contents{$var} = substr ($contents{$var}, 0, -1) . "\\\n";
}
- $contents{$var} .= ' ' . $value;
+ $contents{$var} .= ($contents{$var} && ' ') . $value;
}
else
{
@@ -6585,6 +6592,10 @@ sub read_main_am_file
if $done{$var};
$done{$var} = 1;
+ # Don't process Automake variables.
+ next
+ if $var_is_am{$var};
+
$output_vars .= $am_vars{$var};
if ($conditional{$var})
{
@@ -6807,25 +6818,16 @@ sub file_contents ($%)
my ($var, $type, $val) = ($1, $2, $3);
&prog_error ("$file:$.: macro `$var' with trailing backslash")
if /\\$/;;
+
# Accumulating variables must not be output.
- $contents{$var} = ''
- unless defined $contents{$var};
- $var_is_am{$var} = 1
- unless defined $var_is_am{$var};
- if ($type eq '+')
- {
- $contents{$var} .= ($contents{$var} && ' ') . $val;
- }
- else
- {
- $contents{$var} = $val;
- # If the user has set some variables we were in charge
- # of (which is detected by the first reading of
- # `header-vars.am'), we must not output them.
- $result_vars .= "$separator$comment$_\n"
- if $var_is_am{$var};
+ variable_define ($var, 1, $type, '', $val, $.);
+
+ # If the user has set some variables we were in charge
+ # of (which is detected by the first reading of
+ # `header-vars.am'), we must not output them.
+ $result_vars .= "$separator$comment$_\n"
+ if $type ne '+' && $var_is_am{$var};
- }
$comment = $separator = '';
}
else
@@ -7710,5 +7712,4 @@ sub version ()
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EOF
exit 0;
-
}
- 17-file-contents-uses-variable-define.patch,
Akim Demaille <=