https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80354
--- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> --- (In reply to Alejandro Colomar from comment #10) > Many other warnings are supressed with (void), why is this one so special? Not too many warnings can be suppressed by casts. Those that can must be at least partially implemented in the front end where otherwise pointless casts are still visible. -Wformat-truncation (and other warnings like it) is implemented in the middle-end to benefit from optimizations such as constant propagation or value range optimization. Semantically pointless casts have long been removed from expressions by the time the warning sees the program. It might be possible to use a cast as a suppression mechanism for this warning, but I'm not convinced it would be helpful. Casting value-returning function calls to void is a fairly common style used to denote that the return value is unused. In the case of snprintf, that doesn't necessarily imply that the program is prepared to deal correctly with the truncated output. In my experience very few programs are. Most assume it simply doesn't happen. I don't recall coming across an example involving a non-trivial format string with arguments, especially of numeric types, where truncation would not have caused some sort of an unexpected condition later on in the program.