[PATCH] Fix sis driver to compile with -Werror=format-security

Dan Nicholson dbn.lists at gmail.com
Tue Dec 23 10:33:29 PST 2008


On Tue, Dec 23, 2008 at 10:22 AM, Alan Cox <alan at lxorguk.ukuu.org.uk> wrote:
>> > better patch. On the other hand, if you guys feel there is nothing to be
>> > fixed here I'll just keep the patch for the Mandriva package and let it go.
>>
>> Change str to a macro and use that:
>>
>> #define MSG_SEP "**************************************************\n"
>> ...
>> xf86DrvMsg(pScrn->scrnIndex, X_ERROR, MSG_SEP);
>> ...
>> #undef MSG_STR
>
> GAK
>
> Thats horrible on so many levels
>
> 1. It uglifiers the code enormously

Why is defining a temporary macro any worse than creating a global
character array? It's not like this is going in a public header or
something. People create temporary convienience macros all the time.

> 2. You are trying to hide a compiler thing by confusing the tools, and
> the tools will get smarter and work that out

It's a string literal. How am I trying to confuse the tools? It would
change the argument to actually match what's expected (string literal
for the format field).

If it's really that bad, then I rescind my advice and will move on
with my life. :)

--
Dan



More information about the xorg mailing list