diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-08 23:32:23 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-08 23:32:23 +0000 |
commit | 6d8415dfcd06f712738a0ef683f11f3d50b9d356 (patch) | |
tree | bc97d77632044f39e89c6f57ff0998acec035a7c /gcc/cp | |
parent | e485ad6b3bca72343d9a0f7f2783187394bcb3bd (diff) | |
download | gcc-6d8415dfcd06f712738a0ef683f11f3d50b9d356.tar.gz |
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 7651
* doc/invoke.texi (-Wextra): Move warning from here...
(-Wuninitialized): ... to here.
cp/
* class.c (check_bases_and_members): Warn with -Wuninitialized
instead of -Wextra.
testsuite/
* g++.dg/warn/Wuninitializable-member.C: New.
* g++.dg/warn/Wuninitializable-member-no.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138892 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d37f31f96fb..46370908bec 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR 7651 + * class.c (check_bases_and_members): Warn with -Wuninitialized + instead of -Wextra. + 2008-08-08 Volker Reichelt <v.reichelt@netcologne.de> PR c++/35985 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index f7e46a717aa..b08f9c80d29 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4306,7 +4306,7 @@ check_bases_and_members (tree t) /* If the class has no user-declared constructor, but does have non-static const or reference data members that can never be initialized, issue a warning. */ - if (extra_warnings + if (warn_uninitialized /* Classes with user-declared constructors are presumed to initialize these members. */ && !TYPE_HAS_USER_CONSTRUCTOR (t) @@ -4325,13 +4325,13 @@ check_bases_and_members (tree t) type = TREE_TYPE (field); if (TREE_CODE (type) == REFERENCE_TYPE) - warning (OPT_Wextra, "non-static reference %q+#D in class " - "without a constructor", field); + warning (OPT_Wuninitialized, "non-static reference %q+#D " + "in class without a constructor", field); else if (CP_TYPE_CONST_P (type) && (!CLASS_TYPE_P (type) || !TYPE_HAS_DEFAULT_CONSTRUCTOR (type))) - warning (OPT_Wextra, "non-static const member %q+#D in class " - "without a constructor", field); + warning (OPT_Wuninitialized, "non-static const member %q+#D " + "in class without a constructor", field); } } |