Book a Demo

Author Topic: Invalid code generated when round tripping voids  (Read 2228 times)

rpowen

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Invalid code generated when round tripping voids
« on: June 08, 2010, 10:53:10 pm »
When I reverse engineer a ‘C’ function with a void parameter list (below), EA produces a method on the class with a parameter type void.
Code: [Select]
int MyFunc(void)

When this is forward generated it produces the following function signature:

Code: [Select]
int MyFunc( void prm1 )
When the Keil compiler comes across this it reports “error:  #526: a parameter may not have void type”

Section A8.6.3 of K&R states “…the decelerator for a new-style function with no parameters has a parameter type list consisting solely of the keyword void.”

The problem appears to be with the reverse engineering mistaking the keyword void for a parameter and giving it a name. Does anyone know how to prevent this happening? I could modify the code generation templates to prevent the invalid code being generated, but this wouldn’t prevent illegal signatures being generated for my RTF documentation.

Rob