How can I fix multi #if #elif error
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I ran polyspace bug finder 2015a in 32bit win7.
I have some errors.
I added Preprocessor Macros SAM and SAM=1, SAM=TRUE, SAM=true
But polyspace report error : Error: #error directive: Unsupported device.
#if XMEGA || MEGA || TINY
#include "interrupt/interrupt_avr8.h"
#elif UC3
# include "interrupt/interrupt_avr32.h"
#elif SAM
# include "interrupt/interrupt_sam_nvic.h"
#else
# error Unsupported device.
#endif
0 Kommentare
Antworten (1)
Alexandre De Barros
am 3 Nov. 2016
Hello,
Defining the macro SAM is enough to make the preprocessor process the #elif SAM directive. Actually defining SAM to true or TRUE will override the simple macro definition.
Hence, the two last macros will lead to a compilation error because the #elif SAM statement will become #elif TRUE or #elif true, and true or TRUE are not Ansi-C keywords.
The solution is then to keep only the macro SAM and delete the 3 other ones.
Best regards,
Alexandre
2 Kommentare
Alexandre De Barros
am 5 Nov. 2016
Hello,
this is strange because I tested your sample code with the simple macro SAM defined, and Polyspace was able to process the line #include "interrupt/interrupt_sam_nvic.h".
Then it fails because in my environment Polyspace was not able to find the file "interrupt/interrupt_sam_nvic.h" but this shows that the macro SAM was recognised by the Polyspace preprocessor.
I suggest you to contact the support and attach the verification log, they will be able to see what is going wrong.
Regards,
Alex
Siehe auch
Kategorien
Mehr zu Bug Finder Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!