From: Valdis.Kletnieks@vt.edu
To: Chris Peterson <cpeterso@cpeterso.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: const-correctness warnings from gcc -Wwrite-strings?
Date: Mon, 04 May 2009 22:47:00 -0400 [thread overview]
Message-ID: <58227.1241491620@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Mon, 04 May 2009 17:00:59 PDT." <a24804730905041700i66418576q7b146b05e78884d3@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]
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...
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
prev parent reply other threads:[~2009-05-05 2:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 0:00 Chris Peterson
2009-05-05 2:47 ` Valdis.Kletnieks [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58227.1241491620@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=cpeterso@cpeterso.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®