This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, C] Fix PR40563

On 07/27/2010 09:58 PM, Joseph S. Myers wrote:
On Wed, 21 Jul 2010, Shujing Zhao wrote:

Index: c-decl.c
--- c-decl.c (revision 162361)
+++ c-decl.c (working copy)
@@ -4103,6 +4103,35 @@ start_decl (struct c_declarator *declara
return tem;
+/* 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 this.

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?

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.

Yes, they should be added.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]