lvc / abi-compliance-checker

A tool for checking backward API/ABI compatibility of a C/C++ library
https://lvc.github.io/abi-compliance-checker/
GNU Lesser General Public License v2.1
621 stars 76 forks source link

Can I ignore changes of specific enum member? #113

Closed agrandi closed 2 years ago

agrandi commented 3 years ago

Is it possible to ignore/skip changes to the value of a specific enum member?

For example, I have the following code:

enum options {
  FIRST,
  SECOND,
  MAX
}

According to the guidelines and rules of the project, the member MAX is not part of the official API and is only used internally. Changes to its value are allowed and not considered a problem for backward compatibility. For example, this is a valid change in my project:

 enum options {
   FIRST,
   SECOND,
+  THIRD
   MAX,
 }

But as expected it is flagged in the compatibility report:

Value of member MAX has been changed from 2 to 3.

Can I add MAX to an allow-list so changes to that particular value are not treated as errors?

I saw the option -skip-types but I think it will ignore the entire enum options.

linuxhw commented 3 years ago

Such ENUM values are recognized automatically and changes are treated as low-severity and therefore do not change overall compatibility rate.

To ignore such changes you can change the severity of rule Enum_Last_Member_Value from Low to Safe in modules/RulesBin.xml. The change should move to Other section of the report.

agrandi commented 2 years ago

Thanks for the response and sorry for the delay.

We are scanning our code base with the option -strict which flags these warnings as errors.

I'll try to the suggestion and let you know if it solves the problem!

agrandi commented 2 years ago

This worked great! Thanks for your suggestion.