Corrected checking of constants
diff --git a/abi-compliance-checker.pl b/abi-compliance-checker.pl
index 58f2a49..843b356 100755
--- a/abi-compliance-checker.pl
+++ b/abi-compliance-checker.pl
@@ -1334,6 +1334,7 @@
# Constants (#defines)
my %Constants;
my %SkipConstants;
+my %EnumConstants;
# Types
my %TypeInfo;
@@ -2147,9 +2148,11 @@
setTemplateParams_All();
getTypeInfo_All();
simplifyNames();
+ simplifyConstants();
getVarInfo_All();
getSymbolInfo_All();
+
# clean memory
%LibInfo = ();
%TemplateInstance = ();
@@ -2214,6 +2217,19 @@
undef @Lines;
}
+sub simplifyConstants()
+{
+ foreach my $Constant (keys(%{$Constants{$Version}}))
+ {
+ if($Constants{$Version}{$Constant}{"Value"} eq $Constant)
+ {
+ if(defined $EnumConstants{$Version}{$Constant}) {
+ $Constants{$Version}{$Constant}{"Value"} = $EnumConstants{$Version}{$Constant}{"Value"};
+ }
+ }
+ }
+}
+
sub simplifyNames()
{
foreach my $Base (keys(%{$Typedef_Tr{$Version}}))
@@ -3670,6 +3686,22 @@
}
}
}
+
+ if($TypeAttr{"Type"} eq "Enum")
+ {
+ if(not $TypeAttr{"NameSpace"})
+ {
+ foreach my $Pos (keys(%{$TypeAttr{"Memb"}}))
+ {
+ my $MName = $TypeAttr{"Memb"}{$Pos}{"name"};
+ $EnumConstants{$Version}{$MName} = {
+ "Value"=>$TypeAttr{"Memb"}{$Pos}{"value"},
+ "Header"=>$TypeAttr{"Header"}
+ };
+ }
+ }
+ }
+
return %TypeAttr;
}
@@ -4736,7 +4768,7 @@
if(isInline($InfoId)) {
$SymbolInfo{$Version}{$InfoId}{"InLine"} = 1;
}
- if(hasThrow($FuncInfoId)) {
+ if(hasThrow($InfoId)) {
$SymbolInfo{$Version}{$InfoId}{"Throw"} = 1;
}
if($LibInfo{$Version}{"info"}{$InfoId}=~/ artificial /i) {
@@ -16038,7 +16070,8 @@
if($Priority eq "Low")
{
$Report .= get_Report_ChangedConstants($Level);
- if($ReportFormat eq "html") {
+ if($ReportFormat eq "html")
+ {
if($CheckImpl and $Level eq "Binary") {
$Report .= get_Report_Impl();
}
@@ -16138,6 +16171,7 @@
if($Line=~/\A\#\s*define\s+(\w+)\s+(.+)\s*\Z/)
{
my ($Name, $Value) = ($1, $2);
+ # next if($Name eq $Value);
if(not $Constants{$Version}{$Name}{"Access"})
{
$Constants{$Version}{$Name}{"Access"} = "public";