This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/2972] -Wuninitialized could warn about uninitialized member variable usage in constructors
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jun 2010 08:47:28 -0000
- Subject: [Bug c++/2972] -Wuninitialized could warn about uninitialized member variable usage in constructors
- References: <bug-2972-381@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from manu at gcc dot gnu dot org 2010-06-03 08:47 -------
(In reply to comment #9)
> I've been experimenting with this patch, which warns if there is a missing
> mem-initializer for a scalar.
>
> It gives a false positive for cases were the member is assigned to in the
> constructor body, or otherwise initialized before use, but it's a start, and
> has already helped me find some missing mem-initializers in real code.
Nice but I am afraid there may be too many false positives. And what is
different between this and the -Weffc++ warning given just below it?
>
> + case OPT_Wmeminit:
> + warn_meminit = value;
> + break;
> +
You do not need this. This is handled automatically when you defined Var in the
opt files.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|gdr at gcc dot gnu dot org |unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2972