[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
59-fyi-var-assert.patch
From: |
Akim Demaille |
Subject: |
59-fyi-var-assert.patch |
Date: |
Tue, 30 Oct 2001 17:18:46 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
Index: automake.in
--- automake.in Sat, 27 Oct 2001 18:28:16 +0200 akim
+++ automake.in Sun, 28 Oct 2001 17:06:11 +0100 akim
@@ -317,9 +317,6 @@ sub target_hook ($$$$)
# 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");
}
}
@@ -5779,11 +5775,11 @@ sub macro_define ($$$$$$)
}
-# &variable_delete ($VAR, address@hidden)
-# ---------------------------------
+# ¯o_delete ($VAR, address@hidden)
+# ------------------------------
# Forget about $VAR under the conditions @CONDS, or completely if
# @CONDS is empty.
-sub variable_delete ($@)
+sub macro_delete ($@)
{
my ($var, @conds) = @_;
@@ -5882,6 +5878,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
{
@@ -6207,7 +6221,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;
@@ -6259,6 +6273,7 @@ sub value_to_list
return @result;
}
+
# @VALUES
# variable_value_as_list ($VAR, $COND, $PARENT)
# ---------------------------------------------
@@ -6279,17 +6294,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';
@@ -6322,6 +6328,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
@@ -6330,23 +6340,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})
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 59-fyi-var-assert.patch,
Akim Demaille <=