Polyspace Code Prover expected identifier error
2 views (last 30 days)
Show older comments
Hello,
I have been getting familiar with Polyspace tools but have encountered the following error while trying to analyse my project with Polyspace Code Prover (2016b).
In an include file (that I have already added to the Polyspace project) I have this struct definiton:
typedef struct
{
/* Pointer to actual data */
KeyBaseType * data;
/* Additional information */
VoidPtrType context;
}KeyType
The files where KeyBaseType and VoidPtrType are defined, are also included.
The problem I have encountered is that Polyspace yields this error when it tries to compile:
Error: expected an identifier
KeyBaseType * ;
^
Any idea about why is this happening or what would be a work around is much appreciated.
0 Comments
Answers (1)
Anirban
on 1 Nov 2019
This error can come from multiple causes. Without some indication of the definition of KeyBaseType, it is difficult to answer.
But the fact that 'data' is removed from the error message gives some clue. Are you using the Keil or IAR compiler by any chance? 'data' is a keyword in those compilers. See for instance: http://www.keil.com/support/man/docs/c51/c51_le_keywords.htm
Polyspace removes a bunch of what it considers as keywords during preprocessing since they are not relevant for the analysis: https://www.mathworks.com/help/bugfinder/ug/verify-keilor-iar-dialects.html
To use 'data' as an identifier, see: https://www.mathworks.com/help/bugfinder/ug/keiliar-keywords-removed.html
Alternatively, you can just rename 'data' to something else.
0 Comments
See Also
Categories
Find more on Run Settings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!