From 729e6fda4da38d2b9a5dfa46b80a0dd202df0fc1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 19 Jan 2018 13:14:13 -0600 Subject: [PATCH] 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. --- src/tools/EPICS/Release.pm | 9 +++++---- src/tools/convertRelease.pl | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/EPICS/Release.pm b/src/tools/EPICS/Release.pm index 9ae6610c3..6ae0dbd9a 100644 --- a/src/tools/EPICS/Release.pm +++ b/src/tools/EPICS/Release.pm @@ -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; diff --git a/src/tools/convertRelease.pl b/src/tools/convertRelease.pl index e3fc2644a..d1a054e87 100644 --- a/src/tools/convertRelease.pl +++ b/src/tools/convertRelease.pl @@ -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};