diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-08-23 21:51:48 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-08-23 21:51:48 +0200 |
| commit | 3f3db5422397f1bf8d5af1ade256638d89b1081c (patch) | |
| tree | edc57f9b1048cfbfebd0ff1a3cffcb7c72c764c1 /src/parser.h | |
| parent | 6aa97a68a85b83267de597bfb30b70c04b7de97b (diff) | |
functions that can tail-call must be tail-called as welltail-calls
Otherwise we could "leak" stack frames, which causes crashes on platforms with small stack sizes.
This still did not result in a reproducable speedup with GCC 16.
fixup 2e097cec409182c3cb39b74489387480bf8a278f
Diffstat (limited to 'src/parser.h')
| -rw-r--r-- | src/parser.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/parser.h b/src/parser.h index 75a3432..0441a9c 100644 --- a/src/parser.h +++ b/src/parser.h @@ -557,6 +557,8 @@ gboolean teco_machine_main_step(teco_machine_main_t *ctx, #if __has_attribute(musttail) +#define TECO_TAIL __attribute__((musttail)) + /** * Transition from a teco_machine_main input_cb() to another state. * @@ -608,14 +610,14 @@ gboolean teco_machine_main_step(teco_machine_main_t *ctx, \ /* the caller's signature will not line up exactly with input_cb */ \ typedef teco_state_t *(*caller_t)(teco_machine_main_t *, gunichar, GError **); \ - __attribute__((musttail)) return ((caller_t)__state->input_cb)(__ctx, chr, __error); \ + TECO_TAIL return ((caller_t)__state->input_cb)(__ctx, chr, __error); \ } G_STMT_END #else /* __has_attribute(musttail) */ -/* - * This will effectively return into the teco_machine_main_step() loop. - */ +/* leave it to the optimizer (may or may not tail call) */ +#define TECO_TAIL +/* this will effectively return into the teco_machine_main_step() loop */ #define TECO_RETURN(CTX, STATE, ERROR) return (STATE) #endif /* !__has_attribute(musttail) */ |
