Problem here is that in typedef is declared before the structure definition. Due to this RiCEvent is not treated as identifier in structure definition

 

Please consider following

 

struct RiCEvent {  !<------- RiCEvent here is not treated as identifier because typedef decraration above structure definition makes it as specifier.
   
    /***    User explicit entries    ***/
   
    /* Reactive object that the event is destined for.*/
    struct RiCReactive* destination;                /*## attribute destination */
   
    /* Used with static memory allocation*/
    RiCEventDestroyOp eventDestroyOp;                /*## attribute eventDestroyOp */
   
    /* id of the event.*/
    short lId;                /*## attribute lId */
   
};

Due to this structure definition is treated as definition of anonymous structure and when some specifier is encountered as a tag name in front of struct then

Compiler gives parser error.

 

I have seen the grammar file and some changes need to be made there in the opt_stag rule.

 

Regards,

Jatin


From: sdcc-user-admin@lists.sourceforge.net [mailto:sdcc-user-admin@lists.sourceforge.net] On Behalf Of jernej.turnsek@iskraemeco.si
Sent: Thursday, May 25, 2006 12:02 PM
To: sdcc-user@lists.sourceforge.net
Subject: [Sdcc-user] Problem about typedef

 


Hello,

I have found some strange problem about typedef usage in my project where I am using sdcc compiler. Bellow is my code automatically generated with Rhapsody and the compiler seems to have problems with it:

typedef struct RiCEvent RiCEvent;
struct RiCEvent {
   
    /***    User explicit entries    ***/
   
    /* Reactive object that the event is destined for.*/
    struct RiCReactive* destination;                /*## attribute destination */
   
    /* Used with static memory allocation*/
    RiCEventDestroyOp eventDestroyOp;                /*## attribute eventDestroyOp */
   
    /* id of the event.*/
    short lId;                /*## attribute lId */
   
};


It gives me error message:


RiCEvent.h:42: syntax error: token -> 'RiCEvent'; column 16                       (which is in the line of typedef)

What seems to be a problem? I have manually move typedef after the structure definition and that is OK, but this is not the solution.

Thanks for the reply,

Jernej Turnsek

********************** Legal Disclaimer ****************************

"This email may contain confidential and privileged material for the sole use of the intended recipient. Any unauthorized review, use or distribution by others is strictly prohibited. If you have received the message in error, please advise the sender by reply email and delete the message. Thank you."

**********************************************************************