apnadkarni / tcl-cffi

A Foreign Function Interface extension for Tcl
BSD 2-Clause "Simplified" License
15 stars 2 forks source link

Build errors using cffi 2.0b1 and old gcc versions #206

Open PaulObermeier opened 2 weeks ago

PaulObermeier commented 2 weeks ago

Not really an error, but a feature request to compile cffi on older Linux distributions using gcc 4.X versions (my test system is Suse 42.3 using gcc 4.9.2).

Move the declaration of the following loop variables out of the loop.

./generic/tclCffiInterface.c:262:9: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int j = 0; j < numExplicit; ++j) {

./generic/tclCffiMemory.c:427:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < 4; ++i) {

cffi then compiles fine and test suite is working without error using Tcl 8.6.15.

apnadkarni commented 2 weeks ago

Is there a switch that can be added to gcc 4.9.2 to indicate c99? I'm reluctant to move back from c99 requirements.

PaulObermeier commented 2 weeks ago

Yes, no problem. Just thought, it could be unintentionally.

The compiler itself gives the solution: ./generic/tclCffiInterface.c:262:9: note: use option -std=c99 or -std=gnu99 to compile your code

So I added -std=gnu99 to CFLAGS in BAWT builds.