Re: [PATCH v3] cache.h: auto-detect if zlib has uncompress2()
- From
Beat Bolli <dev+git@drbeat.li>
- Date
- Jan 23, 2022, 00:19 UTC
- Message-ID
- <74d35354-20a6-9cc1-3452-573460c694bd@drbeat.li>
- In-Reply-To
- <xmqqr190ekrh.fsf@gitster.g>
On 22.01.22 00:23, Junio C Hamano wrote:
Show 12 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > >> As noted in the updated commit message this approach of having an >> object just for this fallback function comes at the cost of some >> complexity, but now the compat object lives neatly in its own object. > > I do not see any change in this patch adding costly complexity, but > I notice lack of one possible trick that might become problem with > some compilers and linkers when their zlib has uncompress2() > function. Let's have this graduate very early in the next cycle, to > see if anybody on a rarer system sees a complaint due to having to > deal with a totally empty object file.
OpenSSL has a macro in include/openssl/macros.h to counteract exactly this:
/*
* Sometimes OPENSSL_NO_xxx ends up with an empty file and some
compilers
* don't like that. This will hopefully silence them.
*/
#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;They insert it in the otherwise empty "#else" branch of conditionally complied code.
Cheers, Beat