BBS:      TELESC.NET.BR
Assunto:  src/sbbs3/chat.cpp
De:       Rob Swindell (on Windows 11)
Data:     Fri, 29 May 2026 02:00:51 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/2a0ee8dd1af8b0aad31440fb
Modified Files:
	src/sbbs3/chat.cpp
Log Message:
chat.cpp: hoist declarations to satisfy GCC's "goto crosses init" rule

Build broke on GCC (linux-x64 CI) in chat_llm_session() and
chat_llm_multinode_turn() -- introduced in 683147f9c -- because the
gotos to js_done / mt_done / cleanup labels skipped past
initializations of local variables that were still in scope at the
label.  MSVC accepts this with at most a warning; GCC errors.

Fixes:
- chat_llm_session(): hoisted `bool supports_utf8` above any
  `goto cleanup`.  Hoisted `double speed_factor` / `bool sim_typos`
  to the top of the JS_BEGINREQUEST block, above any `goto js_done`
  from within (they were below the gotos but in the same scope as
  the label).
- chat_llm_multinode_turn(): hoisted `bool supports_utf8` above any
  `goto mt_done`.  Wrapped the `JSString* input_str` / `jsval
  chat_args[]` declarations in an inner brace block so they fall
  out of scope before `mt_done:` instead of straddling it.

Verified locally by single-file MSVC build of chat.cpp (0 errors,
0 warnings).  Structural fix targets exactly the cross-init errors
GCC reported.

CI failure: https://gitlab.synchro.net/main/sbbs/-/jobs/1509516

Co-Authored-By: Claude Opus 4.7 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]