open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
989 stars 162 forks source link

error using a string as a macro argument in WASM #1271

Open pts opened 7 months ago

pts commented 7 months ago
.model tiny
.code
foo macro arg
  db arg
endm
foo 42
foo 'bar'  ; From here: Error! E050: Offset cannot be smaller than WORD size       
end
$ wasm test.asm
Open Watcom Assembler Version 2.0 beta Mar  4 2023 00:50:30 (32-bit)
Copyright (c) 2002-2023 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
test.asm(4): Error! E050: Offset cannot be smaller than WORD size
test.asm(4): Note! N291: macro called from file test.asm(7)
test.asm: 8 lines, 0 warnings, 1 errors

MASM and other assemblers can compile this file successfully. WASM reports an error. Am I using it correctly, or is this a bug?

Baron-von-Riedesel commented 6 months ago

Am I using it correctly, or is this a bug?

It's not a bug, just .... "lacking documentation". Seriously, Wasm's macro engine is not very smart and, IIRC, the first thing what's done with macro arguments is to remove single/double quotes. It also won't help to enclose the macro argument in angle brackets (<>),