cvsuser 04/03/26 01:37:45
Modified: imcc BUGS parser_util.c
imcc/t/syn clash.t
Log:
OpsFile hints - 7
* use label hints for detecting undefined idents
Revision Changes Path
1.9 +0 -6 parrot/imcc/BUGS
Index: BUGS
===================================================================
RCS file: /cvs/public/parrot/imcc/BUGS,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- BUGS 22 Mar 2004 11:00:02 -0000 1.8
+++ BUGS 26 Mar 2004 09:37:39 -0000 1.9
@@ -10,12 +10,6 @@
Also label fixup handling is different so just don't compile
PIR files to PASM except for debugging.
- - statements like "print NO_SUCH_IDENT" are valid, the identifier
- evaluates to -1. There is currently no way, to distinguish a label
- from an identifier, because ops definition files are missing hints,
- which argument might really be a label.
- (Both "branch x" and "print x" are equivalent, basically)
-
- the parser doesn't like empty subs:
.sub _foo
.end
1.64 +5 -0 parrot/imcc/parser_util.c
Index: parser_util.c
===================================================================
RCS file: /cvs/public/parrot/imcc/parser_util.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -w -r1.63 -r1.64
--- parser_util.c 26 Mar 2004 08:05:08 -0000 1.63
+++ parser_util.c 26 Mar 2004 09:37:39 -0000 1.64
@@ -373,6 +373,11 @@
for (i = 0; i < op_info->arg_count-1; i++) {
if (op_info->labels[i+1])
ins->type |= ITBRANCH | (1 << i);
+ else {
+ if (r[i]->type == VTADDRESS)
+ fataly(EX_SOFTWARE, sourcefile, line,
+ "undefined identifier '%s'\n", r[i]->name);
+ }
}
if (op_info->jump) {
ins->type |= ITBRANCH;
1.12 +20 -2 parrot/imcc/t/syn/clash.t
Index: clash.t
===================================================================
RCS file: /cvs/public/parrot/imcc/t/syn/clash.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- clash.t 10 Dec 2003 12:25:21 -0000 1.11
+++ clash.t 26 Mar 2004 09:37:45 -0000 1.12
@@ -1,6 +1,6 @@
#!perl
use strict;
-use TestCompiler tests => 13;
+use TestCompiler tests => 15;
##############################
output_is(<<'CODE', <<'OUT', "if/unless");
@@ -226,4 +226,22 @@
CODE
ok 1
OUTPUT
-1;
+
+output_like(<<'CODE', <<'OUT', "undefined ident");
+.sub _main @MAIN
+ print no_such
+.end
+CODE
+/error.*undefined.*'no_such'/
+OUT
+
+output_is(<<'CODE', <<'OUT', "label ident");
+.sub _main @MAIN
+ branch no_such
+ end
+no_such:
+ print "ok\n"
+.end
+CODE
+ok
+OUT