Skip to content

Commit

Permalink
Allow very long attribute names
Browse files Browse the repository at this point in the history
There are explicit formating rules inside xmltohb.pl when
generating some of the files it creates.  These rules will clip
the size of attribute and enum names without any warning.  This
change will detect any overly long values and override the
formatting rules to create functional (if uglier) code.

Change-Id: I7e5fe455bc6bec680c35bf392c129e1d5d06ac1c
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/89692
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
dcrowell77 authored and Nicholas E Bofferding committed Apr 3, 2020
1 parent 6110ede commit 9f4f5c8
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/usr/targeting/common/xmltohb/xmltohb.pl
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2012,2019
# Contributors Listed Below - COPYRIGHT 2012,2020
# [+] International Business Machines Corp.
# [+] YADRO
#
Expand Down Expand Up @@ -2119,7 +2119,18 @@ sub writeEnumFileAttrIdEnum {
{
$hexVal = $enumerator->{value};
$attrId = $enumerator->{name};
write;

# enforce the implicit length requirement since the format command
# does not throw an error if we overrun
my $enumsize = length($attrId);
if( $enumsize > 55 )
{
print " $attrId = $hexVal,\n";
}
else
{
write;
}
}

print $outFile "};\n\n";
Expand Down Expand Up @@ -2181,7 +2192,18 @@ sub writeEnumFileAttrEnums {
$enumHex = sprintf "0x%08X", $enumHexValue;
}
$enumName = $enumerationType->{id} . "_" . $enumerator->{name};
write;

# enforce the implicit length requirement since the format command
# does not throw an error if we overrun
my $enumsize = length($enumName);
if( $enumsize > 58 )
{
print " $enumName = $enumHex,\n";
}
else
{
write;
}
}
print $outFile "};\n\n";
}
Expand Down

0 comments on commit 9f4f5c8

Please sign in to comment.