Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Johannes Sixt
Am 12.07.19 um 18:44 schrieb Junio C Hamano: > Johannes Sixt writes: > >> Am 12.07.19 um 00:03 schrieb Ramsay Jones: >>> diff --git a/range-diff.c b/range-diff.c >>> index ba1e9a4265..0f24a4ad12 100644 >>> --- a/range-diff.c >>> +++ b/range-diff.c >>> @@ -102,7 +102,7 @@ static int read_patches(c

Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Johannes Sixt
Am 13.07.19 um 12:44 schrieb Johannes Sixt: > Am 12.07.19 um 18:44 schrieb Junio C Hamano: >> Johannes Sixt writes: >> >>> Am 12.07.19 um 00:03 schrieb Ramsay Jones: diff --git a/range-diff.c b/range-diff.c index ba1e9a4265..0f24a4ad12 100644 --- a/range-diff.c +++ b/range-diff

Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Carlo Arenas
On Sat, Jul 13, 2019 at 3:46 AM Johannes Sixt wrote: > > Using only = { 0 } for zero-initialization makes the code immune to > rearrangements of the struct members. But only by forcing to set whichever is the first element to 0, which is exactly what sparse is complaining about, since it happens

Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Junio C Hamano
Johannes Sixt writes: >> Hmm, care to elaborate a bit? Certainly, we have a clear preference >> between these two: >> >> struct patch patch; >> patch.new_name = 0; >> patch.new_name = NULL; >> >> where the "char *new_name" field is the first one in the structure. >> We always tr

Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Carlo Arenas
On Sat, Jul 13, 2019 at 2:29 PM Junio C Hamano wrote: > > I wish if we could say > > struct patch patch = {}; that is actually a GNU extension that is supported by gcc and clang (at least) and that sparse also recognizes as valid; it is also valid C++ so it might be even supported by MSVC

Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings

2019-07-13 Thread Jeff King
On Sat, Jul 13, 2019 at 03:22:03PM -0700, Carlo Arenas wrote: > On Sat, Jul 13, 2019 at 2:29 PM Junio C Hamano wrote: > > > > I wish if we could say > > > > struct patch patch = {}; > > that is actually a GNU extension that is supported by gcc and clang (at least) > and that sparse also

[PATCH] read-cache.c: do not die if mmap fails

2019-07-13 Thread Varun Naik
do_read_index() mmaps the index, or tries to die with an error message on failure. It should call xmmap_gently(), which returns MAP_FAILED, rather than xmmap(), which dies with its own error message. An easy way to cause this mmap to fail is by setting $GIT_INDEX_FILE to a path to a directory and