lkml.org 
[lkml]   [2009]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: const-correctness warnings from gcc -Wwrite-strings?
From
Date
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...
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-05-05 04:49    [W:0.050 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site