From: Akim Demaille Date: Fri, 23 Mar 2001 16:37:46 +0000 (+0000) Subject: * automake.in (¯o_define, &read_am_file): More work for the X-Git-Tag: handle-languages~142 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=976304561fda68a4295bbb1e25b231d40637e6c4;p=automake.git * automake.in (¯o_define, &read_am_file): More work for the former from the latter. Reorganize the latter. --- diff --git a/ChangeLog b/ChangeLog index 6b8dc816..5b1fea63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-03-23 Akim Demaille + + * automake.in (¯o_define, &read_am_file): More work for the + former from the latter. Reorganize the latter. + 2001-03-23 Akim Demaille * automake.in (¯o_define): Extract from... diff --git a/automake.in b/automake.in index a26c960a..c7362d61 100755 --- a/automake.in +++ b/automake.in @@ -5615,6 +5615,15 @@ sub macro_define ($$$$$$) { my ($var, $var_is_am, $type, $cond_string, $value, $where) = @_; + if (defined $contents{$1} + && ($cond_string + ? ! defined $conditional{$1} + : defined $conditional{$1})) + { + &am_line_error ($1, + "$1 defined both conditionally and unconditionally"); + } + if (! defined $contents{$var}) { # The first assignment to a macro sets the line @@ -5670,6 +5679,11 @@ sub macro_define ($$$$$$) ${$conditional{$var}}{$cond_string} = $value; } } + + # 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); } @@ -6427,18 +6441,15 @@ sub read_am_file elsif (($is_ok_macro = /$MACRO_PATTERN/o) || /$BOGUS_MACRO_PATTERN/o) { + # Error if bogus. + &am_line_error ($., "bad macro name `$last_var_name'") + if ! $is_ok_macro; + # Found a macro definition. $was_rule = 0; $last_var_name = $1; - if (defined $contents{$1} - && (@conditional_stack - ? ! defined $conditional{$1} - : defined $conditional{$1})) - { - &am_line_error ($1, - "$1 defined both conditionally and unconditionally"); - } - my $value; + my $type = $2; + my $value = $3; if ($3 ne '' && substr ($3, -1) eq "\\") { # We preserve the `\' because otherwise the long lines @@ -6446,11 +6457,6 @@ sub read_am_file # `sed's. $value = $3 . "\n"; } - else - { - $value = $3; - } - my $type = $2; macro_define ($last_var_name, 0, $type, conditional_string (@conditional_stack), @@ -6460,14 +6466,9 @@ sub read_am_file # all comments for a given variable, no matter where # defined. $am_vars{$last_var_name} = $comment . $spacing; - $def_type{$last_var_name} = ($type eq ':') ? ':' : ''; - push (@var_list, $last_var_name); + $comment = $spacing = ''; $saw_bk = /\\$/; - - # Error if bogus. - &am_line_error ($., "bad macro name `$last_var_name'") - if ! $is_ok_macro; } elsif (/$INCLUDE_PATTERN/o) {