[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 04 May 2009 22:47:00 -0400
From: Valdis.Kletnieks@...edu
To: Chris Peterson <cpeterso@...terso.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: const-correctness warnings from gcc -Wwrite-strings?
On Mon, 04 May 2009 17:00:59 PDT, Chris Peterson said:
> I am preparing a patch that would fix some const-correctness warnings
> when compiling the kernel with gcc -Wwrite-strings. I am not (yet?)
> proposing that the kernel Makefile should use -Wwrite-strings.
>
> String constants are not writable, but without -Wwrite-strings, gcc
> pretends string constants have type non-const char[] to support lazy
> legacy code. :)
Do you have an estimate of how large/intrusive the patch will end up being?
Tossing in a few 'const' s in function signatures shouldn't be too bad.
A bigger problem will be code that does stuff like:
const char foo[] = "defaultstr";
void bar (char *wumpus)
{
baz(wumpus?wumpus:foo);
}
which might get more interesting...
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists