Is there any way to exclude certain function calls from being counted for Code Metrics in Polyspace Bug Finder R2019a?

4 visualizaciones (últimos 30 días)
I am using a macro in my code to add several function calls to log debug information and I would like to avoid these calls being counted for the Polyspace Code Metric "Number of called functions".
Is there a way to exclude those function calls?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 25 de En. de 2025
Editada: MathWorks Support Team el 31 de En. de 2025
There is no way to manipulate metrics—if there is a function call, it will get counted.
As you mentioned, your concern is about a macro for logging debug information. It might be encapsulated with a preprocessor definition like this:
#ifdef DEBUG_ON 
  #define MYMACRO(a) callloggingfunction(a);
#else 
  #define MYMACRO(a)
#endif
In such an example, relaunching the Polyspace analysis by removing the macro using
-D DEBUG_ON in the analysis configuration will provide a different count since the callloggingfunction() function will not be counted in the Metric "Number of called functions" anymore because it is no longer part of the analyzed code.
For reference, please run the following command in the MATLAB R2020b command window to access the documentation:
>> web(fullfile(docroot, 'bugfinder/ref/preprocessordefinitionsd.html'))
If your macro is not encapsulated with a preprocessor definition, another possibility is using the -post-preprocessing-command option to call a Perl script that comments out the call to callloggingfunction(), which will also make it irrelevant for the metrics counts.
More details regarding this option can be found by executing the following command in the MATLAB R2020b command window:
>> web(fullfile(docroot, 'bugfinder/ref/commandscripttoapplytopreprocessedfilespostpreprocessingcommand.html'))
(Still, the first option is the preferable way to handle this.)
Please follow the link below to search for the required information regarding the current release:

Más respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by