Hi,

I remember vaguely the issue about "macro in macro" evaluation by the processor. You must make the PreProc somehow to evalute the nested #def's. I can't remeber exacly now, but I think I found the solution by: looking on the preproc'ed gcc output (-E ??) and the preproc section of the gcc manual on gcc.gnu.org.

If it does not help I can try to look it up.

        G.

[email protected] wrote:
Hi,

i tried to use these macros for simplified port definitions because i want to change only one line when i change the port (PANIC_PORT):


// standard macros (K&R A.12, C-FAQs 11.17)
#   define mc_CAT(x, y) x ## y
#   define mc_XCAT(x, y) mc_CAT(x, y)

#   define PANIC_PORT P3
#   define  PANIC_PORT_DIR mc_XCAT(PANIC_PORT,DIR)
#   define  PANIC_PORT_SEL mc_XCAT(PANIC_PORT,SEL)
#   define  PANIC_PORT_OUT mc_XCAT(PANIC_PORT,OUT) // line 35


and it almost works, but not for the out port, because OUT is defined as 0x0004:


msp430-gcc -mmcu=msp430x168 -O2 -Wall -g -c -o tmp.o tmp.c

tmp.c: In function `kernel_panic':
signal.c:35: `P30x0004' undeclared (first use in this function)

Why is OUT defined?
And can #undef OUT
cause problems?

Regards,

Rolf



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users




Reply via email to