CW assembler has a rich set of conditional assembly directives. I typically would utilize something like the following construct to prevent the multiple definition of a particular label -
LABEL_NAME equ <expression>
[<assembly instructions, macros, data, etc>] ; Optional
These examples seem to work just fine. However, the problem seems to be when the label refers to a macro definition. The label name remains undefined, resulting in error messages about duplicate macro definitions.
include "908_macros.inc" ifndef ILOP ILOP: MACRO ; Reset MCU using illegal opcode DC.B $8D ENDM endif
The above does not work if the macro is also defined with the file "908_macros.inc". The only work-around that I so far have been able to find, is to create a dummy label, in addition to the macro name.
include "908_macros.inc" ifndef _ILOP _ILOP: ; Reset MCU using illegal opcodeILOP: MACRO DC.B $8D ENDM endif
However, in addition to being unwieldy, this method becomes problematic should the include be not modifiable to provide the dummy variable, e.g. such as "derivative.inc".
I wonder if others, who make extensive use of assembly macros, have previously encountered this problem, and perhaps have an alternative "fix". Maybe this is a bug in the assembler, that has never been fixed, or perhaps this was intentional in the design of the assembler.