diff options
author | Fabien Chêne <fabien@gcc.gnu.org> | 2014-04-01 23:14:04 +0200 |
---|---|---|
committer | Fabien Chêne <fabien@gcc.gnu.org> | 2014-04-01 23:14:04 +0200 |
commit | 0df9da030c424d798044b4081865a68c2b08a5e9 (patch) | |
tree | 84bfee0fda0c66608ef4bf1633a1e95340ffc467 /gcc/cp | |
parent | 24991604f284ddfc6463152f5ae16fb3e6a27619 (diff) | |
download | gcc-0df9da030c424d798044b4081865a68c2b08a5e9.zip gcc-0df9da030c424d798044b4081865a68c2b08a5e9.tar.gz gcc-0df9da030c424d798044b4081865a68c2b08a5e9.tar.bz2 |
init.c (perform_member_init): Homogenize uninitialized diagnostics.
2014-04-01 Fabien Chêne <fabien@gcc.gnu.org>
* cp/init.c (perform_member_init): Homogenize uninitialized
diagnostics.
2014-04-01 Fabien Chêne <fabien@gcc.gnu.org>
* g++.dg/init/ctor4.C: Adjust.
* g++.dg/init/ctor4-1.C: New.
* g++.dg/cpp0x/defaulted2.C: Adjust.
From-SVN: r208998
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/ChangeLog-2008 | 4 | ||||
-rw-r--r-- | gcc/cp/ChangeLog-2010 | 20 | ||||
-rw-r--r-- | gcc/cp/ChangeLog-2011 | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog-2012 | 2 | ||||
-rw-r--r-- | gcc/cp/init.c | 31 |
6 files changed, 41 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2e6fd96..332894f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-01 Fabien Chêne <fabien@gcc.gnu.org> + + * cp/init.c (perform_member_init): Homogenize uninitialized + diagnostics. + 2014-04-01 Jason Merrill <jason@redhat.com> PR c++/60708 @@ -44,9 +49,9 @@ 2014-03-26 Fabien Chêne <fabien@gcc.gnu.org> PR c++/52369 - * cp/method.c (walk_field_subobs): improve the diagnostic + * cp/method.c (walk_field_subobs): Improve the diagnostic locations for both REFERENCE_TYPEs and non-static const members. - * cp/init.c (diagnose_uninitialized_cst_or_ref_member): use %q#D + * cp/init.c (diagnose_uninitialized_cst_or_ref_member): Use %q#D instead of %qD to be consistent with the c++11 diagnostic. 2014-03-25 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/ChangeLog-2008 b/gcc/cp/ChangeLog-2008 index 5a69a5d..83fd123 100644 --- a/gcc/cp/ChangeLog-2008 +++ b/gcc/cp/ChangeLog-2008 @@ -307,8 +307,8 @@ * g++spec.c (LIBSTDCXX_STATIC): New. (lang_spec_driver): Use LIBSTDCXX_STATIC when not shared_libgcc. - -2008-11-05 Fabien Chene <fabien.chene@gmail.com> + +2008-11-05 Fabien Chêne <fabien@gcc.gnu.org> PR c++/32519 * cp-tree.h: Fix DECL_NONSTATIC_MEMBER_P to handle member template diff --git a/gcc/cp/ChangeLog-2010 b/gcc/cp/ChangeLog-2010 index 5f56315..e706b7c 100644 --- a/gcc/cp/ChangeLog-2010 +++ b/gcc/cp/ChangeLog-2010 @@ -3127,13 +3127,13 @@ * typeck.c (cp_build_modify_expr): Complain about assignment to array from init list. -2010-05-10 Fabien Chêne <fabien.chene@gmail.com> +2010-05-10 Fabien Chêne <fabien@gcc.gnu.org> PR c++/43719 - * decl.c (check_initializer): strip array type before checking for + * decl.c (check_initializer): Strip array type before checking for uninitialized const or ref members. -2010-05-07 Fabien Chêne <fabien.chene@gmail.com> +2010-05-07 Fabien Chêne <fabien@gcc.gnu.org> PR c++/43951 * init.c (diagnose_uninitialized_cst_or_ref_member_1): Returns the @@ -3258,12 +3258,12 @@ PR c++/43779 * typeck.c (warn_args_num): New function. (convert_arguments): Use warn_args_num to print the diagnostic - messages. + messages. -2010-04-29 Fabien Chêne <fabien.chene@gmail.com> +2010-04-29 Fabien Chêne <fabien@gcc.gnu.org> PR c++/43890 - * init.c (diagnose_uninitialized_cst_or_ref_member): check for + * init.c (diagnose_uninitialized_cst_or_ref_member): Check for user-provided constructor while recursing. 2010-04-28 Manuel López-Ibáñez <manu@gcc.gnu.org> @@ -3277,10 +3277,10 @@ * init.c (perform_member_init): Check CLASS_TYPE_P. -2010-04-27 Fabien Chêne <fabien.chene@gmail.com> +2010-04-27 Fabien Chêne <fabien@gcc.gnu.org> PR c++/29043 - * init.c (perform_member_init): check for uninitialized const or + * init.c (perform_member_init): Check for uninitialized const or reference members, including array types. 2010-04-24 Jason Merrill <jason@redhat.com> @@ -3331,7 +3331,7 @@ convert_like_real. * cp-tree.h: Adjust. -2010-04-27 Fabien Chêne <fabien.chene@gmail.com> +2010-04-27 Fabien Chêne <fabien@gcc.gnu.org> Jason Merrill <jason@redhat.com> PR c++/42844 @@ -3403,7 +3403,7 @@ * call.c (type_decays_to): Call cv_unqualified for non-class type. -2010-04-12 Fabien Chene <fabien.chene@gmail.com> +2010-04-12 Fabien Chêne <fabien@gcc.gnu.org>> PR c++/25811 * cp-tree.h (diagnose_uninitialized_cst_or_ref_member): Declare. diff --git a/gcc/cp/ChangeLog-2011 b/gcc/cp/ChangeLog-2011 index 5065989..02dde6e 100644 --- a/gcc/cp/ChangeLog-2011 +++ b/gcc/cp/ChangeLog-2011 @@ -3511,7 +3511,7 @@ 2011-05-07 Fabien Chêne <fabien@gcc.gnu.org> PR c++/48859 - * init.c (diagnose_uninitialized_cst_or_ref_member_1): stop the + * init.c (diagnose_uninitialized_cst_or_ref_member_1): Stop the recursion if there is user defined constructor. 2011-05-09 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/ChangeLog-2012 b/gcc/cp/ChangeLog-2012 index a57051e..e63a3f7 100644 --- a/gcc/cp/ChangeLog-2012 +++ b/gcc/cp/ChangeLog-2012 @@ -2716,7 +2716,7 @@ 2012-02-16 Fabien Chêne <fabien@gcc.gnu.org> PR c++/52126 - * decl.c (xref_basetypes): call dependent_scope_p instead of + * decl.c (xref_basetypes): Call dependent_scope_p instead of dependent_type_p. 2012-02-16 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/init.c b/gcc/cp/init.c index f85776c..fdc1011 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -694,11 +694,14 @@ perform_member_init (tree member, tree init) if (CP_TYPE_CONST_P (type) && init == NULL_TREE && default_init_uninitialized_part (type)) - /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a - vtable; still give this diagnostic. */ - permerror (DECL_SOURCE_LOCATION (current_function_decl), - "uninitialized member %qD with %<const%> type %qT", - member, type); + { + /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a + vtable; still give this diagnostic. */ + if (permerror (DECL_SOURCE_LOCATION (current_function_decl), + "uninitialized const member in %q#T", type)) + inform (DECL_SOURCE_LOCATION (member), + "%q#D should be initialized", member ); + } finish_expr_stmt (build_aggr_init (decl, init, flags, tf_warning_or_error)); } @@ -710,13 +713,19 @@ perform_member_init (tree member, tree init) tree core_type; /* member traversal: note it leaves init NULL */ if (TREE_CODE (type) == REFERENCE_TYPE) - permerror (DECL_SOURCE_LOCATION (current_function_decl), - "uninitialized reference member %qD", - member); + { + if (permerror (DECL_SOURCE_LOCATION (current_function_decl), + "uninitialized reference member in %q#T", type)) + inform (DECL_SOURCE_LOCATION (member), + "%q#D should be initialized", member); + } else if (CP_TYPE_CONST_P (type)) - permerror (DECL_SOURCE_LOCATION (current_function_decl), - "uninitialized member %qD with %<const%> type %qT", - member, type); + { + if (permerror (DECL_SOURCE_LOCATION (current_function_decl), + "uninitialized const member in %q#T", type)) + inform (DECL_SOURCE_LOCATION (member), + "%q#D should be initialized", member ); + } core_type = strip_array_types (type); |