Re: [PATCH] Fix some sparse warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]