sasagawa888/eisl

error: function definition is not allowed here

Closed this issue · 2 comments

Build prints this error:

In file included from library/tcltk0.c:41:
library/tcltk2.c:69:40: error: function definition is not allowed here
res = ({int res;int ITER(int X, int th){
                                       ^
1 error generated.

Build seems to tolerate these types of errors and succeeds, but the errors shouldn't occur.

Version: 3.70
FreeBSD 14.0

Local functions are a gcc extension. clang has an option for block. With some macrology, you could generate either a local function or a block, but this has invasive implications, since pointers to functions must be converted to pointers to blocks, and pointers to blocks cannot point to functions. In gcc, a pointer to a function can point to a global or local function. It's probably not worth it.

So rewrite it using global functions, and yes, it means that any free variable must be moved as a global variable too, that must be assigned before calling the function.

Or stay with gcc until clang implements the same extension.

Ok, thanks for this explanation.