How can I make adaptions in my sources for a Polyspace Code Prover analysis in R2020a without changing the original code?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 29 Lug 2020
Modificato: MathWorks Support Team
il 13 Ago 2020
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?
Risposta accettata
MathWorks Support Team
il 13 Ago 2020
Modificato: MathWorks Support Team
il 13 Ago 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Run Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!