[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 40-better-messages.patch
From: |
Akim Demaille |
Subject: |
Re: 40-better-messages.patch |
Date: |
03 Apr 2001 20:40:16 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) |
@@ -5617,40 +5634,36 @@ sub variable_define ($$$$$$)
$cond ||= 'TRUE';
- check_ambiguous_conditional ($var, $cond)
- unless $type eq '+';
-
- if (! defined $conditional{$var}{$cond})
+ # A variable which was `+=' must not be `='.
+ if (defined $var_was_plus_eq{$var})
+ {
+ if ($var_was_plus_eq{$var} && $type ne '+')
+ {
+ am_line_error ($var,
+ ("$var was set with `+=' "
+ . "and is now set with `$type='"));
+ }
+ }
+ else
{
- # Initialize: we rely on defined.
- $conditional{$var}{$cond} = '';
-
- # The first assignment to a macro sets the line number. Ideally
- # I suppose we would associate line numbers with random bits of
- # text.
- # 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};
}
+ # An Automake variable can be given to the user, but not the converse.
if (! defined $var_is_am{$var} || !$var_is_am)
{
$var_is_am{$var} = $var_is_am;
}
- if ($type eq '+')
+ # Differentiate the first assignment (including with `+=').
+ if ($type eq '+' && defined $conditional{$var}{$cond})
{
if (substr ($conditional{$var}{$cond}, -1) eq "\n")
- {
- # Insert a backslash before a trailing newline.
- $conditional{$var}{$cond} =
- substr ($conditional{$var}{$cond}, 0, -1) . "\\\n";
- }
+ {
+ # Insert a backslash before a trailing newline.
+ $conditional{$var}{$cond} =
+ substr ($conditional{$var}{$cond}, 0, -1) . "\\\n";
+ }
elsif ($conditional{$var}{$cond})
{
# Insert a separator.
It took me a very long while to formalize the permissions over
variables in Automake. Rules are emerging slowly each time I convert
a new sub (which was directly poking into %conditional) to use
macro_define.
@@ -6567,7 +6590,16 @@ sub read_main_am_file
# First pass.
&define_standard_variables;
- my %saved_conditional = %conditional;
+ # Deep copy. With `%saved_conditional = %conditional' modifying
+ # one modifes the other.
+ my %saved_conditional;
+ foreach my $var (keys %conditional)
+ {
+ foreach my $cond (keys %{$conditional{$var}})
+ {
+ $saved_conditional{$var}{$cond} = $conditional{$var}{$cond};
+ }
+ }
# Read user file, but discard text of variable assignments we just
# made.
Later I have found a more satisfying means (IMHO) to handle the
special case due to these variables. A way to understand my claim is
`just say yes, since this code is obsoleted later with something more
intelligent addressing this issue'.
But before doing this, I need more technology, brought in the next patches.
- Re: 40-better-messages.patch,
Akim Demaille <=