How can I fix multi #if #elif error

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

Answers (1)

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 Comments

Hello Alexandre
I am sorry but I already do it.
It is not working.
First time I just add SAM. It is not working.
Second time, add SAM=1, It is not working
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

Sign in to comment.

Tags

Asked:

on 3 Nov 2016

Community Treasure Hunt

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

Start Hunting!