Does not compile with tcc 0.9.27
Cannot compile either v2.0.3 and v2.1.0 with the latest tcc version from http://repo.or.cz/tinycc.git mob branch.
tcc src/Table.c -c -I ./include -std=gnu99 -Wall -Wno-unused -g -ggdb -fdollars-in-identifiers -fPIC -DCELLO_NSTRACE -o obj/Table.o
src/Table.c:156: error: cannot cast 'struct Tuple' to 'void **'
make: *** [Makefile:125: obj/Table.o] Error 1
However, this page http://libcello.org/learn/best-improvements-of-cello-2.0 under Portability mentions that it can indeed be done
[..] Cello can be compiled easily with all of the major compilers including
gcc,clang,cl.exe, andtcc(on the development branch).
Has anything changed since or has tcc not been tested?
Just not tested recently. I guess some aspect of tcc has changed. It isn't immediately obvious why tcc is throwing that error so I'll have to dig a little deeper to see exactly what is going on.
Would love to see this fixed. I am creating a project that needs to bundle TCC and use Cello. I don't want to have to rely on the system compiler for each platform.
Attempted hello world example using TCC and failed:
tcc -fdollars-in-identifiers -I. example.c -L. -lCello -DCELLO_NSTRACE
#define CELLO_NSTRACE
#include "Cello.h"
int main(int argc, char** argv)
{
print("ASDF\n");
return 0;
}
Compiles with GCC just fine but throws this error when used with TCC:
example.c:6: error: cannot cast 'struct Tuple' to 'void **'
I could be wrong, but I believe it is referring to the string being passed to the print function inside the tuple of arguments.
Also, just discovered this project and I think it is amazing! Keep up the good work!
Thanks I'll try to find some time to work out what has changed. Looks like it might be something in the macros used for variable argument functions...
Have you had a chance to look into this? =)
I took a look. For some reason tcc is expanding macro arguments not really as expected. For example if I do:
var x = new(String);
Then it will throw that error, however if I do this:
var x = new_with(String, tuple());
It works fine...
However the definition of new is pretty much exactly that:
#define new(T, ...) ((struct T*)new_with(T, tuple(__VA_ARGS__)))
Even if you remove all the other stuff you still get the same error:
#define new(T, ...) new_with(T, tuple(__VA_ARGS__))
It seems to be failing to expand tuple(__VA_ARGS__) properly into tuple() when no arguments are passed to these variable argument macros.
Here I am not sure exactly what to do - I tried all my normal preprocessor hacks to try and get it to expand differently but I couldn't find anything that works. Maybe it is worth reporting a bug with tcc and/or to try and dig into the source code to try and fix it?
Either way I have a feeling this is not Cello related and the same issue might exist in normal C programs compiled with tcc. I hope that helps!
Dan
Thank you very much for taking time out of your day to address this. I really appreciate it! Although the new() macro is nice, I will work with new_with() using an empty tuple for now until I can address this issue with TCC.
Thank you for narrowing this down and for creating such an ingenious project!