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

Can't we have sparse fixed (or skip this specific warning) instead?
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to