Polyspace Code Prover expected identifier error

조회 수: 5 (최근 30일)
Mario Jimenez
Mario Jimenez 2019년 9월 26일
답변: Anirban 2019년 11월 1일
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.

답변 (1개)

Anirban
Anirban 2019년 11월 1일
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
Alternatively, you can just rename 'data' to something else.

Community Treasure Hunt

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

Start Hunting!

Translated by