From: Junio C Hamano Date: Sun, 21 Jul 2013 20:58:58 GMT Subject: Re: [PATCH] Fix some sparse warnings Message-ID: <7vmwpfsk8d.fsf@alter.siamese.dyndns.org> In-Reply-To: <20130721173936.GA10647@elie.Belkin> Jonathan Nieder writes: > How about something like the following? > > diff --git i/cache.h w/cache.h > index f2915509..ba028b75 100644 > --- i/cache.h > +++ w/cache.h > @@ -1124,6 +1124,7 @@ struct object_info { > } packed; > } u; > }; > +#define OBJECT_INFO_INIT { NULL, NULL, OI_CACHED, { { NULL, 0, 0 } } } There are quite a many hits from $ git grep '= { *NULL *};' only some of which are "char *var[] = { NULL }", which is perfectly fine, but others are to initialise "struct foo" (or "foo_t" which is typedef'ed) that share the same "writing NULL means the initialiser knows the order of the fields". I doubt if the above #define is a maintainable solution, and worse yet, thinking about the fact that such a macro is necessary only for a structure whose first field happens to be of a pointer type, it strongly suggests me that it is not conceptually the right thing to do. Can't we have sparse fixed (or skip this specific warning) instead?