MATLAB Answers

How can I make adaptions in my sources for a Polyspace Code Prover analysis in R2020a without changing the original code?

7 views (last 30 days)
In some cases, it is necessary to make adaptions to the source code in order to allow Polyspace Code Prover to successfully analyze a code.
How can this be done without changing the original code?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Aug 2020
Edited: MathWorks Support Team on 13 Aug 2020
1) One way is to use Preprocessor definitions (-D):
But in case there are any space characters in the terms you want to remove or change this would not work,
i.e. -D my_macro=const volatile would work, but -D const volatile=volatile is not possible.
Another possibility it to collect all -D macro definitions in a separate header file which is later included in every C file using the option -include. This is a good way to define several macros instead of having to list them all in the project separately.
2) A post-preprocessing-command could be used:
This will be applied after the preprocessing.
3) Or you could make replacements in preprocessor directives using regular expressions directly:
This is also close to what the post-preprocessing-command does, but the regex replacement is done before the preprocessing.

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!