From 0315e90e6e8a2296e8d299c6e06c25b006383e6e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 19 Jan 2018 11:06:23 -0600 Subject: [PATCH 1/3] Revert "tools: Use Carp" This reverts commit f207b00b052037cbb59928e7d5cab1afc6a93a2d. None of these warn/die messages request a stack dump since they all end with \n, but carp & croak ignore that. --- src/tools/EPICS/Copy.pm | 14 ++++++-------- src/tools/EPICS/Release.pm | 10 ++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/tools/EPICS/Copy.pm b/src/tools/EPICS/Copy.pm index d61800e0e..e1ef2a54e 100644 --- a/src/tools/EPICS/Copy.pm +++ b/src/tools/EPICS/Copy.pm @@ -5,8 +5,6 @@ # in file LICENSE that is included with this distribution. #************************************************************************* -use Carp; - # Copy directories and files from a template sub copyTree { @@ -15,7 +13,7 @@ sub copyTree { # $Rtextsubs contains substitutions for file content. opendir my $FILES, $src - or croak "opendir failed while copying $src: $!\n"; + or die "opendir failed while copying $src: $!\n"; my @entries = readdir $FILES; closedir $FILES; @@ -36,9 +34,9 @@ sub copyTree { print "." unless $opt_d; copyFile($srcName, $dstName, $Rtextsubs); } elsif (-l $srcName) { - carp "\nSoft link in template, ignored:\n\t$srcName\n"; + warn "\nSoft link in template, ignored:\n\t$srcName\n"; } else { - carp "\nUnknown file type in template, ignored:\n\t$srcName\n"; + warn "\nUnknown file type in template, ignored:\n\t$srcName\n"; } } } @@ -46,11 +44,11 @@ sub copyTree { sub copyDir { my ($src, $dst, $Rnamesubs, $Rtextsubs) = @_; if (-e $dst && ! -d $dst) { - carp "\nTarget exists but is not a directory, skipping:\n\t$dst\n"; + warn "\nTarget exists but is not a directory, skipping:\n\t$dst\n"; return; } print "Creating directory '$dst'\n" if $opt_d; - mkdir $dst, 0777 or croak "Can't create $dst: $!\n" + mkdir $dst, 0777 or die "Can't create $dst: $!\n" unless -d $dst; copyTree($src, $dst, $Rnamesubs, $Rtextsubs); } @@ -61,7 +59,7 @@ sub copyFile { print "Creating file '$dst'\n" if $opt_d; open(my $SRC, '<', $src) and open(my $DST, '>', $dst) - or croak "$! copying $src to $dst\n"; + or die "$! copying $src to $dst\n"; while (<$SRC>) { # Substitute any @VARS@ in the text s{@(\w+?)@} diff --git a/src/tools/EPICS/Release.pm b/src/tools/EPICS/Release.pm index 98f18514b..9ae6610c3 100644 --- a/src/tools/EPICS/Release.pm +++ b/src/tools/EPICS/Release.pm @@ -5,8 +5,6 @@ # in file LICENSE that is included with this distribution. #************************************************************************* -use Carp; - # # Parse all relevent configure/RELEASE* files and includes # @@ -51,7 +49,7 @@ sub readRelease { "discovered in $file\n"; } - open(my $IN, '<', $file) or croak "Can't open $file: $!\n"; + open(my $IN, '<', $file) or die "Can't open $file: $!\n"; $Ractive->{$file}++; while (<$IN>) { chomp; @@ -79,7 +77,7 @@ sub readRelease { if (-e $path) { &readRelease($path, $Rmacros, $Rapps, $Ractive); } elsif ($op eq "include") { - carp "EPICS/Release.pm: Include file '$path' not found\n"; + warn "EPICS/Release.pm: Include file '$path' not found\n"; } } $Ractive->{$file}--; @@ -109,9 +107,9 @@ sub expandRelease { while (my ($macro, $val) = each %$Rmacros) { while (my ($pre,$var,$post) = $val =~ m/ (.*) \$\( (\w+) \) (.*) /x) { - carp "EPICS/Release.pm: Undefined macro \$($var) used\n" + warn "EPICS/Release.pm: Undefined macro \$($var) used\n" unless exists $Rmacros->{$var}; - croak "EPICS/Release.pm: Circular definition of macro $macro\n" + die "EPICS/Release.pm: Circular definition of macro $macro\n" if $macro eq $var; $val = $pre . $Rmacros->{$var} . $post; $Rmacros->{$macro} = $val; From 729e6fda4da38d2b9a5dfa46b80a0dd202df0fc1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 19 Jan 2018 13:14:13 -0600 Subject: [PATCH 2/3] 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}; From ddbdcf94628d7cac5bdef0f18f03c0255bcb1341 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 21 Jan 2018 00:44:10 -0600 Subject: [PATCH 3/3] rec/test: Add missing filename to DBDDEPENDS_FILES --- src/std/rec/test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/std/rec/test/Makefile b/src/std/rec/test/Makefile index 8084b38b5..5322c8e92 100644 --- a/src/std/rec/test/Makefile +++ b/src/std/rec/test/Makefile @@ -38,6 +38,7 @@ TESTFILES += $(COMMON_DIR)/analogMonitorTest.dbd ../analogMonitorTest.db TESTS += analogMonitorTest TARGETS += $(COMMON_DIR)/regressTest.dbd +DBDDEPENDS_FILES += regressTest.dbd$(DEP) regressTest_DBD += base.dbd TESTPROD_HOST += regressTest regressTest_SRCS += regressTest.c