MATLAB Answers

0

Polyspace Code Prover expected identifier error

Mario Jimenez 님이 질문을 제출함. 26 Sep 2019
최근 활동 Anirban 님이 답변함. 1 Nov 2019
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

로그인 to comment.

답변 수: 1

Anirban 님의 답변 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
Alternatively, you can just rename 'data' to something else.

  댓글 수: 0

로그인 to comment.



Translated by