Skip to content

build: pin tl-parser to C11 for GCC 15 / Clang 16 compatibility#3679

Open
FalconEagleTest wants to merge 1 commit into
tdlib:masterfrom
FalconEagleTest:tl-parser-c11
Open

build: pin tl-parser to C11 for GCC 15 / Clang 16 compatibility#3679
FalconEagleTest wants to merge 1 commit into
tdlib:masterfrom
FalconEagleTest:tl-parser-c11

Conversation

@FalconEagleTest

Copy link
Copy Markdown

The vendored wgetopt.c (Windows-only) uses K&R-style definitions and the legacy declaration extern char *getenv();. GCC 15 and Clang 16 default to -std=gnu23, where () means "no arguments", so the call getenv("POSIXLY_CORRECT") is rejected as too many arguments.

Pin the tl-parser target to C11 on GCC/Clang. MSVC unaffected (the existing /utf-8 /wd4101 /wd4244 /wd4267 block already handles it). Host-side codegen helper -- no runtime impact.

Test plan

  • Built successfully on MSYS2 MinGW64 with GCC 15.2 (previously failed
    at wgetopt.c without this patch).
  • MSVC build path unchanged (this patch is gated on CMAKE_C_COMPILER_ID MATCHES "GNU|Clang").

The vendored wgetopt.c (Windows-only) uses K&R-style definitions and
the legacy declaration `extern char *getenv();`. GCC 15 and Clang 16
default to -std=gnu23, where () means "no arguments", so the call
`getenv("POSIXLY_CORRECT")` is rejected as too many arguments.

Pin the tl-parser target to C11 on GCC/Clang. MSVC unaffected (the
existing /utf-8 /wd4101 /wd4244 /wd4267 block already handles it).
Host-side codegen helper -- no runtime impact.
@levlam

levlam commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I would fix the prototype of getenv instead, because clang emits a warning for the code since clang 15.0 even with C standard explicitly set to C11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants