Book a Demo

Author Topic: Import C-Code does't work for volatile in a typede  (Read 4593 times)

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Import C-Code does't work for volatile in a typede
« on: October 01, 2012, 09:57:02 pm »
Import C-Code does't work for volatile in a typedef

Hi,

all typedefs which have a volatile are completely ignored. E.g.:

typedef volatile int vbool_t;

No generation of a Class, no error message.

Thanks for your help.

Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Import C-Code does't work for volatile in a ty
« Reply #1 on: November 17, 2012, 06:29:36 am »
Late answer, but anyway.
Does such a typedef really make sense, I thought the 'volatile' keyword should apply for particular instances of a type, not to the type itself (though the C compiler might accept such thing)?

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Import C-Code does't work for volatile in a ty
« Reply #2 on: November 17, 2012, 05:40:18 pm »
Hi Günther,

your are right in saying that the volatile keyword makes only sense in the context of an instance. This is in fact true for all typedefs.

A good way of thinking of typedefs is to call them an Alias to have an easy to read definition of an instance / variable.

Besides, it is common practice in the realm of embedded to use such typedefs.

I sent a bug report to SPARX and two days later I got a *.xml file to fix the known problem.


Best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Import C-Code does't work for volatile in a ty
« Reply #3 on: November 18, 2012, 12:20:10 am »
Quote
Besides, it is common practice in the realm of embedded to use such typedefs.
Yeah I know, there are often silly things done in embedded realm if the compiler accepts it. The other way to place 'volatile' when declaring instances is still giving better readable intend IMHO.

Quote
I sent a bug report to SPARX and two days later I got a *.xml file to fix the known problem.
I guess they fixed s.th. for the C parsing process. Can you tell what kind of XML that was and if the error was also fixed in the next standard version.

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Import C-Code does't work for volatile in a ty
« Reply #4 on: November 19, 2012, 06:13:11 pm »
Hello Günther,

1. The bug is fixed in 10 Beta 2

2. *.xml file for MDG technology folder


Code: [Select]
<MDG.Technology version="1.0">
 <Documentation id="12093714" name="Fix Issue: 12093714" version="1.0" notes="Temporary workaround for issue 12093714, where C parsing fails on volatile"/>
<CodeModules>
<CodeModule language="C" notes="">
<CodeOptions>
 <CodeOption name="PrependGrammarDefinitions"> <fullType> ::= (<constOrVolatile>)* <nonEmptyType> <far> <optReferenceType> (<constOrVolatile>)* [<funcPtrExt>] | <fail>; <constOrVolatile> ::= "const" | "volatile"; </CodeOption>
 </CodeOptions>
 </CodeModule>
 </CodeModules>
 </MDG.Technology>

Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)