tools: Add some context to the 'Undefined macro' warning

Mark Rivers saw this warning when he forgot to configure and build a
dependent module properly. The additional information given by this
change would have helped him track down the problem faster.
This commit is contained in:
Andrew Johnson
2018-01-19 13:14:13 -06:00
parent 0315e90e6e
commit 729e6fda4d
2 changed files with 6 additions and 5 deletions

View File

@@ -99,17 +99,18 @@ sub expandMacros {
}
#
# Expand all (possibly nested) macros in dictionary
# Expand all (possibly nested) macros in a dictionary
#
sub expandRelease {
my ($Rmacros) = @_;
my ($Rmacros, $warn) = @_;
# $Rmacros is a reference to a hash
$warn = '' unless defined $warn;
while (my ($macro, $val) = each %$Rmacros) {
while (my ($pre,$var,$post) = $val =~ m/ (.*) \$\( (\w+) \) (.*) /x) {
warn "EPICS/Release.pm: Undefined macro \$($var) used\n"
warn "EPICS/Release.pm: Undefined macro \$($var) used $warn\n"
unless exists $Rmacros->{$var};
die "EPICS/Release.pm: Circular definition of macro $macro\n"
die "EPICS/Release.pm: Circular definition of macro $var $warn\n"
if $macro eq $var;
$val = $pre . $Rmacros->{$var} . $post;
$Rmacros->{$macro} = $val;

View File

@@ -220,7 +220,7 @@ sub checkRelease {
my @order = ();
my $relfile = "$path/configure/RELEASE";
readReleaseFiles($relfile, \%check, \@order, $arch);
expandRelease(\%check);
expandRelease(\%check, "while checking module\n\t$app = $path");
delete $check{TOP};
delete $check{EPICS_HOST_ARCH};