Interference between my definition & processor definition

The struct PMMMODEBITS is like this,
__extension__ typedef struct tagPMMODEBITS {
union {
——————
struct {
unsigned WAITE:2;
unsigned WAITM:4;
unsigned WAITB:2;
unsigned MODE:2;
unsigned :1;
unsigned INCM:2;
unsigned IRQM:2;
};
};
} PMMODEBITS;

Check the presence of the ‘MODE’ member in the struct.

Unfortunately I had defined a macro inside my test file as, [to switch between
static & dynamic tests]
#define STATIC    0
#define DYNAMIC   1
#define MODE      STATIC

Preprocessor was doing like this,
__extension__ typedef struct tagPMMODEBITS {
union {
——————
struct {
unsigned WAITE:2;
unsigned WAITM:4;
unsigned WAITB:2;
unsigned 0:2;
unsigned :1;
unsigned INCM:2;
unsigned IRQM:2;
};
};
} PMMODEBITS;

MODE was being replaced by its value ‘STATIC’ – 0
After MODE was renamed to something else say, TMR_MODE it worked fine.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s