[Bug c/57137] New: spurious "format string is not literal" when the format string is marked with __attribute__((format))
zbyszek at in dot waw.pl
gcc-bugzilla@gcc.gnu.org
Wed May 1 16:20:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57137
Bug #: 57137
Summary: spurious "format string is not literal" when the
format string is marked with __attribute__((format))
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zbyszek@in.waw.pl
If the format string is marked as a printf format with an attribute
format((printf(...)) on the wrapper function, then gcc should know that it's
either a valid printf format, or will be warned about at the point
where it is passed to the wrapper function, and shouldn't warn that
the format string is not a literal.
Attached example gives:
unit.c: In function ‘unit_status_printf’:
unit.c:6:9: warning: format not a string literal, argument types not checked
[-Wformat-nonliteral]
manager_status_printf(status, unit_status_msg_format, "xxx");
^
It is possible to work around by placing #pragma GCC diagnostic ignored
"-Wformat-nonliteral" before the function, but that feels like a kludge.
More information about the Gcc-bugs
mailing list