Skip to content

Commit 4f2400c

Browse files
authored
Hint to {interpolate} names when EQUS expanding does not occur (#1692)
1 parent 063d284 commit 4f2400c

File tree

7 files changed

+41
-1
lines changed

7 files changed

+41
-1
lines changed

src/asm/symbol.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ static void alreadyDefinedError(Symbol const &sym, char const *asType) {
141141
}
142142
fputs(" at ", stderr);
143143
dumpFilename(sym);
144+
if (sym.type == SYM_EQUS) {
145+
fprintf(
146+
stderr,
147+
" (should it be {interpolated} to define its contents \"%s\"?)\n",
148+
sym.getEqus()->c_str()
149+
);
150+
}
144151
}
145152
}
146153

test/asm/builtin-overwrite.err

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,34 @@ error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(6):
3232
Built-in symbol '__ISO_8601_UTC__' cannot be purged
3333
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(9):
3434
'__ISO_8601_UTC__' already defined at <builtin>
35+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
3536
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(10):
3637
'__ISO_8601_UTC__' already defined at <builtin>
38+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
3739
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(13):
3840
'__ISO_8601_UTC__' already defined as constant at <builtin>
41+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
3942
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(14):
4043
'__ISO_8601_UTC__' already defined as constant at <builtin>
44+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
4145
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(17):
4246
'__ISO_8601_UTC__' already defined at <builtin>
47+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
4348
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(18):
4449
'__ISO_8601_UTC__' already defined at <builtin>
50+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
4551
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(21):
4652
'__ISO_8601_UTC__' already defined as constant at <builtin>
53+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
4754
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(22):
4855
'__ISO_8601_UTC__' already defined as constant at <builtin>
56+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
4957
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(25):
5058
'__ISO_8601_UTC__' already defined as non-EQU at <builtin>
59+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
5160
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(26):
5261
'__ISO_8601_UTC__' already defined as non-EQU at <builtin>
62+
(should it be {interpolated} to define its contents ""1989-04-21T12:34:56Z""?)
5363
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(29):
5464
Built-in symbol '__ISO_8601_UTC__' cannot be redefined
5565
error: builtin-overwrite.asm(37) -> builtin-overwrite.asm::tickle(30):

test/asm/command-line-symbols.err

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
error: command-line-symbols.asm(3):
22
'FOO' already defined at <command-line>
3+
(should it be {interpolated} to define its contents "hello"?)
34
error: Assembly aborted (1 error)!

test/asm/def.asm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ redef string equs "there"
2828

2929
redef constant equ 6*9
3030
println constant
31+
32+
macro mac
33+
endm
34+
35+
redef mac equ 42
36+
37+
def name equs "constant2"
38+
def name equ 1337
39+
40+
redef name equs "mac2"
41+
macro name
42+
endm

test/asm/def.err

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
error: def.asm(23):
22
'constant' already defined at def.asm(10)
3-
error: Assembly aborted (1 error)!
3+
error: def.asm(35):
4+
'mac' already defined as non-EQU at def.asm(32)
5+
error: def.asm(38):
6+
'name' already defined at def.asm(37)
7+
(should it be {interpolated} to define its contents "constant2"?)
8+
error: def.asm(42):
9+
'name' already defined at def.asm(40)
10+
(should it be {interpolated} to define its contents "mac2"?)
11+
error: Assembly aborted (4 errors)!

test/asm/for.err

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ warning: for.asm(20): [-Wbackwards-for]
66
FOR goes backwards from 1 to 2 by -1
77
error: for.asm(46):
88
's' already defined as constant at for.asm(39)
9+
(should it be {interpolated} to define its contents "x"?)
910
error: for.asm(48) -> for.asm::REPT~4(54):
1011
'v' already defined as constant at for.asm(48) -> for.asm::REPT~4(52)
1112
FATAL: for.asm(48) -> for.asm::REPT~4(54):

test/asm/redef-equ.err

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
error: redef-equ.asm(25):
22
'N' already defined as non-EQU at redef-equ.asm(24)
3+
(should it be {interpolated} to define its contents "X"?)
34
error: Assembly aborted (1 error)!

0 commit comments

Comments
 (0)