Limit auto-declaration of record types to regRecDevDrv only

Allowing this while expanding DBD files for IOCs can insert other
device supports before of the Base "Soft Channel" ones, making the
other type the default. Adds a note that DBD file order matters.

Fixes lp: #1908305
This commit is contained in:
Andrew Johnson committed 2021-02-27 16:48:55 -06:00
1 parent e881cb15c4
commit bee00658ae
3 files changed
+9 -2

No files matched your search

@@ -1,2 +1,2 @@
include "xxxRecord.dbd"
device(xxx,CONSTANT,devXxxSoft,"SoftChannel")
device(xxx,CONSTANT,devXxxSoft,"Soft Channel")
+5 -1
View File
@@ -29,6 +29,7 @@ use DBD::Function;
use DBD::Variable;
our $debug=0;
our $allowAutoDeclarations=0;
sub ParseDBD {
(my $dbd, $_) = @_;
@@ -102,8 +103,11 @@ sub ParseDBD {
unquote($1, $2, $3, $4);
my $rtyp = $dbd->recordtype($record_type);
if (!defined $rtyp) {
my $msg = "Device '$choice' defined for unknown record type '$record_type'.";
dieContext($msg, "DBD files must be added in the correct order.")
unless $allowAutoDeclarations;
warn "$msg\nRecord type '$record_type' declared.\n";
$rtyp = DBD::Recordtype->new($record_type);
warn "Device using unknown record type '$record_type', declaration created\n";
$dbd->add($rtyp);
}
$rtyp->add_device(DBD::Device->new($link_type, $dset, $choice));
@@ -31,6 +31,9 @@ my @path = map { split /[:;]/ } @opt_I; # FIXME: Broken on Win32?
my ($file, $subname, $bldTop) = @ARGV;
# Permit auto-declaration of record types for building runtime-loadable modules
$DBD::Parser::allowAutoDeclarations = 1;
my $dbd = DBD->new();
ParseDBD($dbd, Readfile($file, "", \@path));