Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-07
11:07 • Closed ticket [0cb3554903]: macOS 13 SDK deprecates sprintf() plus 6 other c... artifact: c40346f237 user: jan.nijtmans
11:06
Fix [0cb3554903] (again): macOS 13 SDK deprecates sprintf() check-in: 6561f34fe3 user: jan.nijtmans tags: core-9-0-branch
10:51
Fix [0cb3554903] (again): macOS 13 SDK deprecates sprintf() check-in: 55a4b1b5ed user: jan.nijtmans tags: trunk, main
2026-10-06
23:26 • Open ticket [0cb3554903]: macOS 13 SDK deprecates sprintf() plus 4 other cha... artifact: 9069e37f5d user: chrstphrchvz
23:25 • Ticket [0cb3554903]: 5 changes artifact: a7f4073381 user: chrstphrchvz
2023-09-12
12:49 • Closed ticket [0cb3554903]. artifact: 6ad3888fc2 user: jan.nijtmans
2023-03-30
21:20
Fix [0cb3554903]: macOS 13 SDK deprecates sprintf() check-in: 5ee652454c user: jan.nijtmans tags: core-8-6-branch
15:19
Fix [0cb3554903]: macOS 13 SDK deprecates sprintf(). But better not use it on other platforms either... closed check-in: ec56f33813 user: jan.nijtmans tags: bug-0cb3554903
2023-03-28
14:19 • Ticket [0cb3554903] macOS 13 SDK deprecates sprintf() status still Open with... artifact: c69915181c user: jan.nijtmans
2023-03-26
10:29 • New ticket [0cb3554903]. artifact: 6f6a5c82af user: chrstphrchvz

macOS 13 SDK deprecates sprintf()

Closed / Fixed0cb3554903fc141964afbaaee2602e1fe9906e88Created 4 years agoUpdated 56 days ago
Descriptionwiki2023-03-26 10:29:37
sprintf() is deprecated as of the macOS 13 SDK, causing many compiler warnings to be emitted when building Tcl, e.g.:
tcl/generic/regerror.c:77:2: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
        sprintf(convbuf, "%d", r->code); /* -1 for unknown */
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^

I notice sprintf() has recently been eradicated from Tk 8.6; will there be a similar effort for Tcl 8.6, or is this won’t-fix for 8.6?

Referenced by4
jan.nijtmanswiki2023-03-28 14:19:53

I think it would be wise to do the same for Tcl 8.6 (and up) too.

jan.nijtmanswiki2023-09-12 12:49:19

Fixed [here]

Closing

chrstphrchvzwiki2026-10-06 23:25:38

Reopening: after this ticket was closed, the tip-688 branch was merged, introducing two calls to sprintf().

tcl91/generic/tclClockFmt.c:3461:26: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
 3461 |                     dateFmt->output += sprintf(dateFmt->output, map->tostr, val);
      |                                        ^
tcl91/generic/tclClockFmt.c:3493:22: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
 3493 |                 dateFmt->output += sprintf(dateFmt->output, map->tostr, val);
      |                                    ^

chrstphrchvz Open ticket [0cb3554903]. [History diff]2026-10-06 23:26:00
jan.nijtmanswiki2026-10-07 11:07:35

Fixed (again) [here] and in core-9-0-branch too.

Thanks for the reminder!

Log in (anonymous is fine) to add a comment.