Using .macro argument in .error message?

Georg-Johann Lay avr@gjlay.de
Sun Jun 7 19:16:17 GMT 2026


Test case err.sx:

.macro Test data
     .if \data < 0
         .error "value \data is negative"
     .endif
.endm

     Test -1


$ avr-as err.sx -v
GNU assembler version 2.45.50 (avr) using BFD version (GNU Binutils) 
2.45.50.20250718
err.sx: Assembler messages:
err.sx: Warning: unknown escape '\d' in string; ignored
err.sx:3: Error: value -1 is negative
err.sx:7:  Info: macro invoked from here

While the printed error message is as expected, there is a spurious
warning about using \d in the string.

What am I missing?

As far as I understand, the .error message /must/ be "-quoted.

Thank you

Johann



More information about the Binutils mailing list