public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] c++/2972 warn when ctor-initializer leaves uninitialized data
Date: Thu, 10 Nov 2011 20:28:00 -0000	[thread overview]
Message-ID: <4EBC315C.1030309@redhat.com> (raw)
In-Reply-To: <4EBC2FA7.1000504@redhat.com>

On 11/10/2011 03:10 PM, Jason Merrill wrote:
> On 11/10/2011 02:48 PM, Jonathan Wakely wrote:
>> +warn_missing_meminits (tree type, tree cons)
>> +{
>> + tree mem_inits = sort_mem_initializers (type, NULL_TREE);
>> + while (mem_inits)
>> + {
>> + tree member = TREE_PURPOSE (mem_inits);
>> + /* TODO do not warn if brace-or-equal-initializer */
>> + warn_meminit_leaves_uninitialized (member, TREE_TYPE (member), cons);
>> + mem_inits = TREE_CHAIN (mem_inits);
>> + }
>> +}
>
> Check DECL_INITIAL (member) to tell if it has an NSDMI.

Actually, why not just use default_init_uninitialized_part (type)?

> +  if (warn_meminit && (kind == sfk_constructor || kind == sfk_copy_constructor
> +        || kind == sfk_move_constructor))
> +    warn_missing_meminits (current_class_type, fn);

We only want to do this for sfk_constructor; the others initialize all 
fields.

Jason

  reply	other threads:[~2011-11-10 20:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 21:47 Jonathan Wakely
2011-11-07 21:58 ` Jason Merrill
2011-11-10 20:17   ` Jonathan Wakely
2011-11-10 20:25     ` Jason Merrill
2011-11-10 20:28       ` Jason Merrill [this message]
2011-11-11  0:00         ` Jonathan Wakely
2011-11-07 22:42 ` Gabriel Dos Reis
2011-11-07 22:42   ` Jason Merrill
2011-11-08  0:18     ` Gabriel Dos Reis
2011-11-07 23:28   ` Jonathan Wakely

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=4EBC315C.1030309@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).