public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Brian Gitonga Marete <marete@toshnix.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector and -Werror
Date: Tue, 19 Oct 2010 17:03:04 +0800	[thread overview]
Message-ID: <20101019090304.GA5211@cr0.nay.redhat.com> (raw)
In-Reply-To: <20101019064000.GC21782@elte.hu>

On Tue, Oct 19, 2010 at 08:40:00AM +0200, Ingo Molnar wrote:
>
>* Brian Gitonga Marete <marete@toshnix.com> wrote:
>
>> On Tue, Oct 19, 2010 at 2:38 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
>> > On Tue, Oct 19, 2010 at 02:24:00AM +0300, Brian Gitonga Marete wrote:
>> >> The following patch fixes compilation of the perf user-space tools on,
>> >> for example, gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) . It should not
>> >> break anything else.
>> >
>> >
>> >
>> > Hi,
>> >
>> > What kind of warning have you encountered and why it fixes it?
>> > Can you describe that in your changelog?
>> >
>> 
>> Hello Frederic,
>> 
>> Some versions of gcc, e.g. gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4), have the 
>> (default) minimum size of buffers protected by `-fstack-protector' set to 8. But 
>> in perf, there exist much smaller automatic buffers.
>
>Hm, it's this code:
>
>        /* newtWinChoice should really be accepting const char pointers... */
>        char yes[] = "Yes", no[] = "No";
>        return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
>
>I.e. the code is messy and GCC is right to warn about it. Hence it would be somewhat 
>bad to actually remove the warning that pointed out some dodgy piece of code.

Agreed.

>
>Even if marking it const doesnt work due to the external libnewt API, we could at 
>least put 'yes' and 'no' into file scope and mark them static?
>

How about making ui__dialog_yesno() a macro? ;) Like:

#define ui__dialog_yesno(msg) \
	({newWinChoice(NULL, "Yes", "No", (char *)(msg)) == 1;})

  reply	other threads:[~2010-10-19  8:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 23:24 [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector and -Werror Brian Gitonga Marete
2010-10-18 23:38 ` Frederic Weisbecker
2010-10-19  0:06   ` Brian Gitonga Marete
2010-10-19  0:20     ` Frederic Weisbecker
2010-10-19  6:40     ` Ingo Molnar
2010-10-19  9:03       ` Américo Wang [this message]
2010-10-19 11:12       ` Brian Gitonga Marete
2010-10-19 11:33         ` Brian Gitonga Marete
2010-10-19 11:37           ` Brian Gitonga Marete
2010-10-19 11:49           ` Ingo Molnar
2010-10-19 13:11             ` Arnaldo Carvalho de Melo
2010-10-24 21:23               ` [PATCH] Fix a compile error with -fstack-protector, -Wstack-protector " Brian Gitonga Marete
2010-11-11 10:25               ` [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector " Eric Dumazet
2010-11-11 17:05                 ` Arnaldo Carvalho de Melo
2010-11-11 17:13                   ` Eric Dumazet

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=20101019090304.GA5211@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marete@toshnix.com \
    --cc=mingo@elte.hu \
    /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