https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88270
Bug ID: 88270 Summary: -Wformat-XXX option for flagging %m Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: eblake at redhat dot com Target Milestone: --- I was working porting a project originally written for Linux over to BSD systems, and had to fix code that called printf("%m") to spell out longhand printf("%s", strerror(errno)). Sadly, I couldn't find a -Wformat-FOO flag that would have let the compiler spot these instances on my behalf. At the same time, I found it a lot easier to write my own wrapper function [1] that expanded %m in-place before passing things on to the real printf-family functions (easy, since %m doesn't require parsing the rest of the format string or rewriting the va_list argument), rather than manually expand all existing %m in the code base, since most format strings in the code base already went through a common wrapper function. Of course, my wrapper is given __attribute__((printf...)), so that I can preserve compiler checking of -Wformat. But in that case, while I'd want -Wformat-FOO to warn about %m in native printf, I do NOT want it warning about %m passed to my wrapper. So the attribute system may also need tweaking to make this sort of compiler-aided portability flagging easier to implement. [1] https://github.com/libguestfs/nbdkit/commit/1c230358462c3495330