Hello,
I have following code and macros:
I have been using it quite some time with C51 compiler, no problem, it is expanded by preprocessor to
which is correct and as I want it. However, I had to move to new architecture and this is what armcc produces from the very same piece of code
The line order is wrong, name is not replaced by the first macro parameter and \ is not removed. I would be very grateful for any ideas how to fix that/make it work
Thanks
Entik
I have following code and macros:
Code:
struct tagged_class
{
unsigned short tag;
char *format;
};
#define BEGIN_CLASS(name, tag, fmt) \
struct tagged_class name##_class = { tag, fmt }; \
struct name { \
struct tagged_class *klass;
#define END_CLASS };
BEGIN_CLASS(cstring, 101, "s")
char* value;
END_CLASS
I have been using it quite some time with C51 compiler, no problem, it is expanded by preprocessor to
Code:
struct tagged_class cstring_class = { 101, "s" };
struct cstring {
struct tagged_class *klass;
char* value;
};
which is correct and as I want it. However, I had to move to new architecture and this is what armcc produces from the very same piece of code
Code:
struct name {
struct tagged_class *klass;
struct tagged_class cstring_class = { 101, "s" }; \
char* value;
};
The line order is wrong, name is not replaced by the first macro parameter and \ is not removed. I would be very grateful for any ideas how to fix that/make it work
Thanks
Entik