Compiling with -gen gcc
FreeBasic v1.04+ now has a stable GCC emitter (C with GCC extensions) backend. It allows the engine to be ported to non-x86 platforms such as smart phones, consoles, and PowerPC Macs.
To compile with -gen gcc, just run: scons gengcc=1. -gen gcc is used automatically when it is necessary (e.g. 64 bit builds, Mac). It takes longer to compile, so is not the default.
Using gengcc has the advantage that GCC throws some warnings that FB does not; mainly set-but-unused-variable and wrong type (missing cast) warnings.
However it also seems to throw additional "branch crossing variable definition" warnings due to GOSUBs as well as the following warnings which can be ignored:
Unused variables[edit]
Some variables are meant to be unused, including DUMMY$4 (dummy) in addtrigger (this variable can't be removed due to a syntax quirk), and lots of dummy variables in the test programs.
Missing braces[edit]
warning: missing braces around initializer [-Wmissing-braces] warning: (near initialization for 'remember_mouserect.<anonymous>') [-Wmissing-braces]
FB is generating slightly incorrect syntax for XYPair literals.
Expected void **[edit]
In function '_Z5V_NEWRPPvi': warning: passing argument 1 of 'array_new' from incompatible pointer type [enabled by default] note: expected 'void **' but argument is of type 'void ***' In function '_Z8V_APPENDRPPvRS_': warning: passing argument 1 of 'array_append' from incompatible pointer type [enabled by default] note: expected 'void **' but argument is of type 'void ***'
This is more concerning; FB is omitting a cast that it apparently should be emitting. Luckily in this case the missing cast is totally harmless. Unreported: no success yet in producing a testcase.