We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3375

Summary: Fix "format not a string literal" errors
Product: SDL Reporter: Bastien Nocera <bugzilla>
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72, bugzilla, philipp.wiesemann
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Fix "format not a string literal" errors
Fix "format not a string literal" errors

Description Bastien Nocera 2016-06-23 15:17:51 UTC
With GCC 6.1 on Fedora 24.
Comment 1 Bastien Nocera 2016-06-23 15:19:21 UTC
Created attachment 2514 [details]
Fix "format not a string literal" errors

With GCC 6.1.
Comment 2 Alex Szpakowski 2016-06-24 19:24:53 UTC
it seems better to me to change the code so the warnings don't happen in the first place, rather than making gcc ignore the warnings.
Comment 3 Bastien Nocera 2016-06-24 19:33:54 UTC
This is the "low impact, went through on my machine". I can look at reducing the work-arounds is that's what it would take.

I'm pretty sure that we won't be able to fix all of them without external API changes though. Not sure that's what you'd want.
Comment 4 Philipp Wiesemann 2016-06-25 18:01:17 UTC
Some of the warnings should have been fixed here: http://hg.libsdl.org/SDL/rev/8eeab279c545

The warnings also showed up if the string constants were modified to static. As the strings were just passed around and never modified locally, these warnings actually seemed to be mostly false positives.
Comment 5 Bastien Nocera 2016-06-26 07:28:01 UTC
Created attachment 2517 [details]
Fix "format not a string literal" errors

With GCC 6.1.
Comment 6 Bastien Nocera 2016-06-28 08:53:33 UTC
I don't think there's a way to fix the remaining warnings without working around them as done in the patch.
Comment 7 Philipp Wiesemann 2016-07-02 21:53:04 UTC
The warning in "SDL_test_log.c" might be fixed by inlining the format string. But this creates new warning with "-Wformat-y2k" which might lead to the same failure in the end.
Comment 8 Sam Lantinga 2016-10-01 17:37:03 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/fa4e35434a9c