Macros and Messages
In static analysis of C/C++ programs, it’s quite certain to come across both:
Warnings found by the static analysis and the use of macros in the analysed source code.
Things start to get interesting when both come together: Who caused the warning, the macro alone or its use in a certain context?
Sometimes that’s easy and unambiguous:
In this example, one would expect the warning at the macro, not at the assignment to i.
But the following is trickier:
In this example, the problem only arises because of the specific kind of use of the macro.
A message at the macro itself would confuse the developer.
Due to these differences, the Axivion Suite offers both options, namely to report violations at the macro or at the use of the macro.
The user decides where the message should appear with the rule option report_at_macro_invocation.
The upcoming version 7 of Axivion Suite additionally offers an automatic mode which intelligently decides this case by case.
(Dr. Stefan Staiger-Stöhr, Head of Development)
If you have any questions about this or other topics related to our Axivion Suite, please feel free to contact us!