How can I make adaptions in my sources for a Polyspace Code Prover analysis in R2020a without changing the original code?
1 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-7-29
编辑: MathWorks Support Team
2020-8-13
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?
采纳的回答
MathWorks Support Team
2020-8-13
编辑:MathWorks Support Team
2020-8-13
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!