Tcl Source Code

View Ticket
Login
Ticket UUID: ae62bacc43e4c89cc8602faee8a664e14dacd8fd
Title: -Wformat warnings with MSYS2 UCRT64: TCL_LL_MODIFIER "I64" is checked as gnu_printf
Type: Bug Created on: 2026-10-29 10:07:11
Submitter: serhiy.storchaka Assigned to: jan.nijtmans
Subsystem: 53. Configuration and Build Tools Severity: Minor
Priority: 5 Medium Last modified: 2026-10-29 16:47:51
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-29 10:54:07
Version: 8.6.18, 9.0.5, 9.1.1
Description:

Building with MSYS2 UCRT64 (gcc 16.2.0) gives many -Wformat warnings, all on format strings using TCL_LL_MODIFIER, TCL_Z_MODIFIER or TCL_T_MODIFIER:

generic/tkBind.c:2985:50: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat=]
generic/tclStrToD.c:5315:44: warning: 'I' flag used with '%x' gnu_printf format [-Wformat=]

With -D__USE_MINGW_ANSI_STDIO=0, which configure sets, tcl.h defines TCL_LL_MODIFIER as "I64", but the UCRT64 headers check the formats as gnu_printf, which does not know I64. The counts: Tcl 11 (8.6), 31 (9.0), 29 (9.1); Tk 52 (8.6), 57 (9.0), 67 (9.1).

This was reported in [c975939973], closed as Remind because 8.6 has to support the Windows XP runtime. A UCRT build uses the UCRT printf, which accepts ll, so perhaps "ll" could be used when _UCRT is defined.

User Comments:
jan.nijtmans added on 2026-10-29 10:54:07:

Good idea!

Thanks! Merged to [14e76b55b7c270a6]. Will also be merged to core-9-0-branch and core-8-6-branch


serhiy.storchaka added on 2026-10-29 16:47:51:

Tk still gets these warnings: generic/tkInt.h undefines TCL_LL_MODIFIER and defines it again with the old condition, so it needs the same !defined(_UCRT). With that, Tk 9.1 builds without warnings with MSYS2 UCRT64.