This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, C] Fix PR40563
On 07/27/2010 09:58 PM, Joseph S. Myers wrote:
On Wed, 21 Jul 2010, Shujing Zhao wrote:Thanks.
--- c-decl.c (revision 162361)
+++ c-decl.c (working copy)
@@ -4103,6 +4103,35 @@ start_decl (struct c_declarator *declara
+/* Subroutine of finish_decl. Diagnose uninitialized const member of type TYPE.
+ DECL is the original declaration. */
This comment is unclear. What you seem to mean is: TYPE is the type of an
uninitialized object DECL. If that object has a const member, diagnose
Why do you need to recurse down among fields? Why isn't checking
C_TYPE_FIELDS_READONLY enough?It used to notice which field should be initialized, just like the diagnostics
at c++. If the notice is not very necessary, C_TYPE_FIELDS_READONLY is enough.
What if the original uninitialized object is not a structure but an array
of structures? Will you diagnose things in that case?
C++ would not error an uninitialized array of structure that has a const member.
So I think it doesn't need warn at C?
Yes, they should be added.
You don't appear to have any testcases where the recursion is needed for
diagnosis, or where the member in question is an array, only tests
directly involving a const scalar element of the structure or union.