FTBFS if "-Werror=format-security" flag is used
Kevin Kofler
kevin.kofler at chello.at
Fri Dec 6 19:11:09 UTC 2013
Adam Jackson wrote:
> On Fri, 2013-12-06 at 02:21 +0100, Kevin Kofler wrote:
>
>> QString line;
>> line.fill( '-', 60 );
>> qDebug( line.ascii() );
>> As you can see, the format string being passed here is provably constant.
>
> So fix the compiler.
I don't think GCC will ever be able to prove that it is a constant. It would
at least have to do intermodule inlining on the linked qstring.o to do that,
which means qt3 would have to use the LTO support. Even then, I wouldn't
count on it. Plus, if this construct were found in application code rather
than in qt3 itself, GCC would even have to do the intermodule inlining on
libqt-mt, which would also have negative consequences on binary
compatibility.
But knowing the contract of QString (Qt 3's in this case, but it's the same
in Qt 4 and Qt 5), it's trivial for a human to prove it.
Kevin Kofler
More information about the devel
mailing list