Skip to content
Snippets Groups Projects

Adding check for duplicate non-case-sensitive part names that could cause...

2 unresolved threads
1 file
+ 13
4
Compare changes
  • Side-by-side
  • Inline
@@ -732,8 +732,9 @@ for($ii=0;$ii<$nonSubCnt;$ii++)
#// emit c code that will be lowercased (causing collisions)
$ftotal = $partCnt;
my %seen;
my %seen; #Hashmap that keeps track of the names we have seen before
my %noCode = map {$_ => 1} qw(INPUT OUTPUT BUSC BUSS FROM GOTO); #List of non-generating parts
my @duplicates = ();
for($kk=0;$kk<$partCnt;$kk++)
{
@@ -752,9 +753,8 @@ for($kk=0;$kk<$partCnt;$kk++)
and not exists $noCode{$partType[$kk]}
and not exists $noCode{ $seen{ lc $xpartName[$kk] }[1] } )
{
die "ERROR - Part name is: ($xpartName[$kk], $partType[$kk]), other part is ($seen{ lc $xpartName[$kk]}[0], $seen{ lc $xpartName[$kk]}[1])\n" .
"Two parts, that generate code, with the same name (but diffrent capitalization) were found. " .
"This can cause an issue with code generation.\nPlease rename one of the parts.\n";
push(@duplicates, "First (part, type) is: ($xpartName[$kk], $partType[$kk]),".
" other part is ($seen{ lc $xpartName[$kk]}[0], $seen{ lc $xpartName[$kk]}[1])\n");
}
else
{
@@ -763,6 +763,15 @@ for($kk=0;$kk<$partCnt;$kk++)
}
}
if ( 0+@duplicates > 0) #If we found 1 or more issues
{
my @whole_error = "ERROR - Some part(s) failed the duplicate name check." .
"Two parts, that generate code, with the same name (but diffrent capitalization) were found. " .
"This can cause an issue with code generation, please rename one of the parts, from each pair.\n";
@whole_error = @whole_error . join('', @{$duplicates});
die @whole_error;
}
print "Total parts to process $ftotal\n";
# DIAGNOSTIC
Loading