From: Akim Demaille Date: Tue, 30 Oct 2001 16:31:17 +0000 (+0000) Subject: * automake.in ($verbose): Remove, inherited from X-Git-Tag: Release-1-5b~54 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5682a62fbbf057f6cc324bb5f55130f436a569e6;p=automake.git * automake.in ($verbose): Remove, inherited from Automake::General. (&variable_delete): Rename as... (¯o_delete): this, for consistency. (&variable_assert): New. (&variable_value_as_list, &variable_value_as_list_recursive_worker): Use it. --- diff --git a/ChangeLog b/ChangeLog index 8e78a17f..d1db0f55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,18 @@ +2001-10-30 Akim Demaille + + * automake.in ($verbose): Remove, inherited from + Automake::General. + (&variable_delete): Rename as... + (¯o_delete): this, for consistency. + (&variable_assert): New. + (&variable_value_as_list, &variable_value_as_list_recursive_worker): + Use it. + 2001-10-29 Akim Demaille * m4/lispdir.m4 (AM_PATH_LISPDIR): Use AC_RUN_LOG to avoid cluttering configure's stdout. - 2001-10-28 Akim Demaille * automake.in: Various formatting changes. @@ -69,7 +78,7 @@ (&initialize_per_input): Don't initialize several times the same vars. - + 2001-10-28 Akim Demaille * automake.in (scan_one_autoconf_file): When using %generalize, be diff --git a/automake.in b/automake.in index 2e9d528c..39886206 100755 --- a/automake.in +++ b/automake.in @@ -317,9 +317,6 @@ my $default_strictness_name = 'gnu'; # included in generated Makefile.in. my $cmdline_use_dependencies = 1; -# TRUE if in verbose mode. -my $verbose = 0; - # This holds our (eventual) exit status. We don't actually exit until # we have processed all input files. my $exit_status = 0; @@ -2365,8 +2362,7 @@ sub check_canonical_spelling foreach my $xt (@suffixes) { macro_error ("$name$xt", - "invalid variable `$name$xt'; " - . "should be `$xname$xt'") + "invalid variable `$name$xt'; should be `$xname$xt'") if variable_defined ("$name$xt"); } } @@ -5785,11 +5781,11 @@ sub macro_define ($$$$$$) } -# &variable_delete ($VAR, [@CONDS]) -# --------------------------------- +# ¯o_delete ($VAR, [@CONDS]) +# ------------------------------ # Forget about $VAR under the conditions @CONDS, or completely if # @CONDS is empty. -sub variable_delete ($@) +sub macro_delete ($@) { my ($var, @conds) = @_; @@ -5888,6 +5884,24 @@ sub variable_defined ($;$) } +# $BOOLEAN +# variable_assert ($VAR, $WHERE) +# ------------------------------ +# Make sure a variable exists. $VAR is the variable name, and $WHERE +# is the name of a macro which refers to $VAR. +sub variable_assert ($$) +{ + my ($var, $where) = @_; + + return 1 + if variable_defined $var; + + macro_error ($where, "variable `$var' not defined"); + + return 0; +} + + # Mark a variable as examined. sub examine_variable { @@ -6213,7 +6227,7 @@ sub variable_value # be returned; otherwise, warn if VAR is conditionally defined. # SCANNED is a global hash listing whose keys are all the variables # already scanned; it is an error to rescan a variable. -sub value_to_list +sub value_to_list ($$$) { my ($var, $val, $cond) = @_; my @result; @@ -6265,6 +6279,7 @@ sub value_to_list return @result; } + # @VALUES # variable_value_as_list ($VAR, $COND, $PARENT) # --------------------------------------------- @@ -6285,17 +6300,8 @@ sub variable_value_as_list my @result; # Check defined - if (! defined $var_value{$var}) - { - if (defined $targets{$var}) - { - macro_error ($var, "`$var' is a target; expected a variable"); - } - else - { - macro_error ($parent, "variable `$var' not defined"); - } - } + return + unless variable_assert $var, $parent; # Get value for given condition $cond ||= 'TRUE'; @@ -6328,6 +6334,10 @@ sub variable_value_as_list return @result; } + +# @VALUE +# &variable_value_as_list_recursive_worker ($VAR, $COND, $PARENT) +# --------------------------------------------------------------- # Return contents of variable as list, split as whitespace. This will # recursively follow $(...) and ${...} inclusions. It preserves @...@ # substitutions. If COND is 'all', then all values under all @@ -6336,23 +6346,15 @@ sub variable_value_as_list # that condition should be returned; otherwise, warn if VAR is # conditionally defined. If PARENT is specified, it is the name of # the including variable; this is only used for error reports. -sub variable_value_as_list_recursive_worker +sub variable_value_as_list_recursive_worker ($$$) { my ($var, $cond, $parent) = @_; my @result = (); - if (! defined $var_value{$var}) - { - if (defined $targets{$var}) - { - macro_error ($var, "`$var' is a target; expected a variable"); - } - else - { - macro_error ($parent, "variable `$var' not defined"); - } - } - elsif (defined $vars_scanned{$var}) + return + unless variable_assert $var, $parent; + + if (defined $vars_scanned{$var}) { # `vars_scanned' is a global we use to keep track of which # variables we've already examined.