mbeddr / mbeddr.core

The mbeddr core. An extensible C
Eclipse Public License 2.0
223 stars 77 forks source link

Compilation errors when structs with same name exist in different modules #1075

Closed stephaneberle9 closed 10 years ago

stephaneberle9 commented 10 years ago

This is caused by the fact that struct names (in contrast to union names, e.g.) don't get prefixed with the name of their modules.

E.g., I have a struct

exported struct MyData { ... };

in a module named "MyModule".

Expected generated code in "MyModule.h":

struct MyModule_MyData { ... };

Actual generated code in "MyModule.h":

struct MyData { ... };

bkolb commented 10 years ago

works for me. seems to be not valid anylonger. Please reopen with an

stephaneberle9 commented 10 years ago

Steps to reproduce:

You should then get the following compilation error:

In file included from MetrologyNodeStack.h:11:0, from CalibrationTest.h:13, from CalibrationTest.c:1: MetrologyFlashMemory.h:37:16: error: redefinition of 'struct S_InformationMemory' typedef struct S_InformationMemory { ^ In file included from ApplicationNodeStack.h:13:0, from CalibrationTest.h:11, from CalibrationTest.c:1: ApplicationFlashMemory.h:41:16: note: originally defined here typedef struct S_InformationMemory { ^ In file included from MetrologyNodeStack.h:11:0, from CalibrationTest.h:13, from CalibrationTest.c:1: MetrologyFlashMemory.h:39:3: error: conflicting types for 'InformationMemory' } InformationMemory; ^ In file included from ApplicationNodeStack.h:13:0, from CalibrationTest.h:11, from CalibrationTest.c:1: ApplicationFlashMemory.h:43:3: note: previous declaration of 'InformationMemory' was here } InformationMemory; ^

szabta89 commented 10 years ago

This problem is related to the fact that these structs had the prevent name mangling flag set to true, but the editor for the struct declaration didn't display that. This has been changed now, and I have also removed the flags from the mentioned structs.