mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Eduardo Silva <edsiper@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel: Fix ftrace.c compiler warning when calling ftrace_nop_replace()
Date: Mon, 23 May 2011 09:08:34 -0400	[thread overview]
Message-ID: <1306156114.1465.37.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4DD9BA2F.9000303@zytor.com>

On Sun, 2011-05-22 at 18:36 -0700, H. Peter Anvin wrote:
> On 05/22/2011 06:19 PM, Eduardo Silva wrote:
> > the function ftrace_nop_replace() returns a 'static const unsigned char *'
> > value, so when the caller perform a direct assignment to a
> > 'static unsigned char *', the compiler raise the following warning message:
> > 
> >  ftrace.c:308:6: warning: assignment discards qualifiers from pointer target type
> >  ftrace.c:318:6: warning: assignment discards qualifiers from pointer target type
> > 
> > Adding the proper casts the message goes away.
> > 
> > Signed-off-by: Eduardo Silva <edsiper@gmail.com>
> 
> This quiets a warning of something that potentially looks like a real
> bug.  Perhaps "new" should be const?

Although there is no real bug here, I hate these "hide the warning"
patches.

The real solution is to change all the users into const *. This should
be doable as the new and old pointers are not modified.

And remember:

	char *changes;
	const char *no_changes;

	no_changes = changes;  /* is OK! (no compiler warnings) */

	changes = no_changes; /* is not OK. (compiler will warn). */

-- Steve



  parent reply	other threads:[~2011-05-23 13:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23  1:19 Eduardo Silva
2011-05-23  1:36 ` H. Peter Anvin
2011-05-23  2:27   ` Eduardo Silva
2011-05-23 13:08   ` Steven Rostedt [this message]
2011-05-23 20:01     ` John Kacur
2011-05-23 20:05       ` H. Peter Anvin

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=1306156114.1465.37.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=edsiper@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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®