foo := 4
print foo, bar
+ // trigger duplicate-main error
+ func main()
+ foo := 6
+ print bar, foo
+
###### output: type_err_const
.tmp.code:4:16: error: expected number found string
.tmp.code:6:8: error: name already declared: bar
.tmp.code:4:8: info: this is where 'bar' was first declared
.tmp.code:8:8: error: variable 'foo' redeclared
.tmp.code:3:8: info: this is where 'foo' was first declared
+ .tmp.code:13:8: error: variable 'foo' redeclared
+ .tmp.code:3:8: info: this is where 'foo' was first declared
+ .tmp.code:13:8: "main" defined a second time
###### test: type_err_const1
const
{NULL, 0, NULL, 0},
};
const char *options = "tpnbs";
+
+ static void pr_err(char *msg)
+ {
+ fprintf(stderr, "%s\n", msg); // NOTEST
+ }
+
int main(int argc, char *argv[])
{
int fd;
context.file_name = argv[optind];
len = lseek(fd, 0, 2);
file = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
- s = code_extract(file, file+len, NULL);
+ s = code_extract(file, file+len, pr_err);
if (!s) {
fprintf(stderr, "oceani: could not find any code in %s\n",
argv[optind]);