ArrayList iterator causes gcc to throw errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ooc |
Fix Committed
|
Low
|
Unassigned |
Bug Description
I was using ArrayList in some code I was writing, but no matter what I did ooc would compile the code fine, but gcc was throwing errors. Finally I decided to run the foreach-arraylist test, and it also errors. Here's an example session:
$ ooc -v tests/sugar/
Compiling source 'tests.
Found dependency structs.List' imported from 'tests.
Compiling source 'structs.List'
Found dependency Iterable' imported from 'structs.List, importing...
Compiling source 'structs.Iterable'
Found dependency Iterator' imported from 'structs.Iterable, importing...
Compiling source 'structs.Iterator'
Compiling source 'OocLib'
Found dependency Iterator' imported from 'structs.List, importing...
Found dependency structs.ArrayList' imported from 'tests.
Compiling source 'structs.ArrayList'
Found dependency List' imported from 'structs.ArrayList, importing...
Found dependency Iterator' imported from 'structs.ArrayList, importing...
Found dependency Iterable' imported from 'structs.ArrayList, importing...
/usr/bin/gcc -std=c99 -c ooc_tmp/
ooc_tmp/
ooc_tmp/
/usr/bin/gcc -std=c99 -c ooc_tmp/
/usr/bin/gcc -std=c99 -c ooc_tmp/OocLib.c -I /opt/ooc/
/usr/bin/gcc -std=c99 -c ooc_tmp/
/usr/bin/gcc -std=c99 -c ooc_tmp/
/usr/bin/gcc -std=c99 ooc_tmp/
ooc_tmp/
ooc_tmp/
Changed in ooc-language: | |
status: | Confirmed → Fix Committed |
Those are only warnings, thus they don't prevent compilation / running the program.
They are caused by a lack of casts in the generated C code. If everything was casted correctly in the C code, there would be no warnings and it still would work perfectly.
This is an issue I considered low priority for the 0.2 release, since it doesn't prevent compilation etc., but I see it confuses people a lot.
You can have a better notification of whether the build was successful or not by running with the option:
$ ooc -backend=gcc,-s blah.ooc
where s means shout. Or, if you are running a 0.3 build (e.g. from git), you can simply do
$ ooc -shout blah.ooc
This will print a big fat [ OK ] or [FAIL].