Re: [PATCH v2 00/19] hashmap bug/safety/ease-of-use fixes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 29, 2019, 09:22 UTC
- Message-ID
- <xmqqy2y7ihih.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190924010324.22619-1-e@80x24.org>
Eric Wong <e@80x24.org> writes:
Show 13 quoted lines
> Patches 1-11 are largely unchanged from the original series with the > exception of 2, which is new and posted at: > > https://public-inbox.org/git/20190908074953.kux7zz4y7iolqko4@whir/ > > 12-17 take further steps to get us away from hashmap_entry being > the first element, but they're also a bit ugly because __typeof__ > isn't portable > > 18-19 finally brings me to the APIs I want to expose without > relying on __typeof :) > > Apologies for the delays, been busy with other stuff...
Thanks. clang version 6.0.1-10 (which is the version I happen to have installed locally) seems to throw a lot of errors like these:
-- -- --
$ make CC=clang config.o
CC config.o
config.c:1944:50: error: variable 'entry' is uninitialized when used here [-Werror,-Wuninitialized]
hashmap_for_each_entry(&cs->config_hash, &iter, entry,
^~~~~
./hashmap.h:453:20: note: expanded from macro 'hashmap_for_each_entry'
OFFSETOF_VAR(var, member)); \
^~~
./git-compat-util.h:1346:16: note: expanded from macro 'OFFSETOF_VAR'
((uintptr_t)&(ptr)->member - (uintptr_t)(ptr))
^~~
./hashmap.h:445:61: note: expanded from macro 'hashmap_iter_first_entry_offset'
container_of_or_null_offset(hashmap_iter_first(map, iter), offset)
^~~~~~
config.c:1939:34: note: initialize the variable 'entry' to silence this warning
struct config_set_element *entry;
^
= NULL
1 error generated.
make: *** [Makefile:2365: config.o] Error 1-- -- --
even though gcc seems to be happy with the source.