It would be nice if scanners could be generated which declare all global variables as _Thread_local. This would allow thread-safe scanners to be generated without having to use the reentrant API.
I tried modifying the skeleton file for this purpose but it seems that the declarations in the generated code are incompatible; you get a couple of errors like this:
target/gensrc/scanner.c:328:21: error: non-thread-local declaration of ‘yyout’ follows thread-local declaration
FILE *yyin = NULL, *yyout = NULL;
^~~~~
target/gensrc/scanner.c:159:35: note: previous declaration of ‘yyout’ was here
extern _Thread_local FILE *yyin, *yyout;
^~~~~
I think if a macro like YY_THREAD_LOCAL would exist with possible values being "_Thread_local" or "", then it would be easy to switch it on and off.
Thanks!
It would be nice if scanners could be generated which declare all global variables as _Thread_local. This would allow thread-safe scanners to be generated without having to use the reentrant API.
I tried modifying the skeleton file for this purpose but it seems that the declarations in the generated code are incompatible; you get a couple of errors like this:
I think if a macro like YY_THREAD_LOCAL would exist with possible values being "_Thread_local" or "", then it would be easy to switch it on and off.
Thanks!