FTBFS if "-Werror=format-security" flag is used

Miloslav Trmač mitr at volny.cz
Tue Dec 10 15:35:52 UTC 2013


On Tue, Dec 10, 2013 at 3:50 PM, Kevin Kofler <kevin.kofler at chello.at> wrote:
> drago01 wrote:
>
>> On Tue, Dec 10, 2013 at 3:00 AM, Kevin Kofler <kevin.kofler at chello.at>
>> wrote:
>>> [...] and removes functionality
>>
>> No it does not.
>
> Yes, it does, see my example:
> | a printf wrapper for logging which adds a timestamp in front of the
> | format string, e.g.
> | log("processed %d items", foo);
> | which would be printed as
> | 2013-12-06 19:00:00: processed 123 items
> | to some logfile (using vfprintf with a format string like
> | "2013-12-06 19:00:00: processed %d items"
> | concatenated at runtime).
>
> -Werror=format-security removes the functionality of building format strings
> at runtime, and there are legitimate uses for such functionality.

(info gcc) says that format-security only applies to calls "where the
format string is not a string literal _and there are no format
arguments_", which is not the case for the wrapper above.  Is the
documentation incorrect?
     Mirek


More information about the devel mailing list