mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-15 16:06:21 +00:00
Handle invalid expressions in .WORD directives with a message.
This is most relevant in implied .WORD directives which are caused by an attempt to call a macro (which happens to be undefined) with arguments that don't parse as valid expressions.
This commit is contained in:
parent
ff5179743c
commit
c423ee346a
@ -653,9 +653,14 @@ int do_word(
|
||||
} else {
|
||||
EX_TREE *value = parse_expr(cp, 0);
|
||||
|
||||
store_value(stack, tr, size, value);
|
||||
if (value->cp > cp) {
|
||||
store_value(stack, tr, size, value);
|
||||
|
||||
cp = value->cp;
|
||||
cp = value->cp;
|
||||
} else {
|
||||
report(stack->top, "Invalid expression in .WORD\n");
|
||||
cp = ""; /* force loop to end */
|
||||
}
|
||||
|
||||
free_tree(value);
|
||||
}
|
||||
|
||||
@ -6,7 +6,18 @@
|
||||
# If there is a .objd.ok file, it compares the result of dumpobj.
|
||||
#
|
||||
|
||||
TESTS="test-asciz test-backpatch test-bsl-mac-arg test-complex-reloc test-endm test-include test-jmp test-locals test-macro-comma test-undef test-word-comma"
|
||||
TESTS="test-asciz \
|
||||
test-backpatch \
|
||||
test-bsl-mac-arg \
|
||||
test-complex-reloc \
|
||||
test-endm \
|
||||
test-impword \
|
||||
test-include \
|
||||
test-jmp \
|
||||
test-locals \
|
||||
test-macro-comma \
|
||||
test-undef \
|
||||
test-word-comma"
|
||||
|
||||
for t in $TESTS
|
||||
do
|
||||
|
||||
12
tests/test-impword.mac
Normal file
12
tests/test-impword.mac
Normal file
@ -0,0 +1,12 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test the implied .word construction
|
||||
;
|
||||
|
||||
start: 3
|
||||
start
|
||||
; The following could be a macro which by accident is not defined
|
||||
; which takes arguments that don't parse as expressions.
|
||||
macro 8-BIT,1,2,3
|
||||
; The following can by accident be parsed as an expression.
|
||||
macro 7-BIT,1,2,3
|
||||
Loading…
x
Reference in New Issue
Block a user