On Tue, Mar 19, 2013 at 10:02 PM, Milutin Jovanović <jovanovic.milu...@gmail.com> wrote: > > This is only a filename, or precisely extension issue. If you rename your > intermediate file from "stateblock.i" to "stateblock-i.c", I believe > everything should work. > > Miki. > > > On 19 March 2013 23:10, Austin English <austinengl...@gmail.com> wrote: >> >> Howdy, >> >> I'm trying to narrow down a file that fails to compile with tinycc, >> but works with gcc/clang. The exact error is: >> stateblock.c:875: error: '}' expected (got ",") >> >> I wanted to use multidelta to reduce the testcase, but quickly found >> that trying to recompile a preprocessed file with tcc fails: >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ tcc -E -I. >> -I../../../include -DWINE_STRICT_PROTOTYPES >> -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT >> -fPIC -I/usr/include/freetype2 -o stateblock.i stateblock.c >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ echo $? >> 0 >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ tcc -c -I. >> -I../../../include -DWINE_STRICT_PROTOTYPES >> -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT >> -fPIC -I/usr/include/freetype2 -o stateblock.o stateblock.i >> stateblock.i:1: error: unrecognized file type >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ echo $? >> 1 >> >> but this works with gcc/clang: >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ gcc -E -I. >> -I../../../include -DWINE_STRICT_PROTOTYPES >> -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT >> -fPIC -I/usr/include/freetype2 -o stateblock.i stateblock.c >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ echo $? >> 0 >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ gcc -c -I. >> -I../../../include -DWINE_STRICT_PROTOTYPES >> -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT >> -fPIC -I/usr/include/freetype2 -o stateblock.o stateblock.i >> austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ echo $? >> 0 >> >> Is it possible to get tcc to use the preprocessed source? >> >> Thanks in advance, >> -Austin >> >> _______________________________________________ >> Tinycc-devel mailing list >> Tinycc-devel@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Yes, this (mostly) works: austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ tcc -E -I. -I. -I../../../include -I../../../include -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT -fPIC -I/usr/include/freetype2 -g -o stateblock-i.c stateblock.c austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ tcc -c -I. -I. -I../../../include -I../../../include -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS -D_REENTRANT -fPIC -I/usr/include/freetype2 -g -o stateblock.o stateblock-i.c stateblock-i.c:14963: error: invalid number this exposes a second bug: #define MAX_LANA 0xfe ... typedef struct _LANA_ENUM { UCHAR length; UCHAR lana[MAX_LANA+1]; } LANA_ENUM, *PLANA_ENUM; is expanded to: typedef struct _LANA_ENUM { UCHAR length; UCHAR lana[0xfe+1]; } LANA_ENUM, *PLANA_ENUM; whereas with gcc/clang: typedef struct _LANA_ENUM { UCHAR length; UCHAR lana[0xfe +1]; } LANA_ENUM, *PLANA_ENUM; (I filed that here: https://savannah.nongnu.org/bugs/index.php?38557) manually correcting that, I'm able to preprocess the problematic file down to: austin@debian-home:~/src/wine-tcc/dlls/d3d8/tests$ cat stateblock.i.tcc.c typedef struct _D3DVECTOR { float x; float y; float z; } D3DMATRIX; struct transform_data { D3DMATRIX view; D3DMATRIX projection; D3DMATRIX texture0; D3DMATRIX texture7; D3DMATRIX world0; D3DMATRIX world255; }; static const struct transform_data transform_default_data = { {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }}}, }; int main(void) { return 0; } compiling that minimalized source with gcc/clang does generate some warnings, but does not fail (as it does with tcc). The full source file generates no errors or warnings on gcc/clang. See also https://savannah.nongnu.org/bugs/index.php?37243 -- -Austin _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel