Re: [PATCH 41/68] init: use strbufs to store paths
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 30, 2015, 20:00 UTC
- Message-ID
- <xmqqh9mb7k3r.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20150930002347.GA23406@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> On Tue, Sep 29, 2015 at 04:50:39PM -0700, Michael Blume wrote: > >> I see compile errors on my mac: >> >> First a whole bunch of >> >> ./compat/precompose_utf8.h:30:45: warning: declaration of 'struct >> strbuf' will not be visible outside of this function [-Wvisibility] >> void probe_utf8_pathname_composition(struct strbuf *path); > > Wow, my patch isn't even close to reasonable. I didn't realize because > we do not compile this code at all for non-Mac platforms. Sorry.
Perhaps the way we completely stub out the platform specific helpers contributes to this kind of gotchas? I am wondering how much additional safety we would gain if we start doing something like this.
Two things to note:
* "struct strbuf" needs to be visible when the compiler sees this part, which is an indication of the same issue shown in the above error message, is not addressed.
* precompose_str() does not seem to be defined or used, hence removed.
git-compat-util.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h index 712de7f..6710ff7 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -227,9 +227,11 @@ typedef unsigned long uintptr_t; #ifdef PRECOMPOSE_UNICODE #include "compat/precompose_utf8.h" #else -#define precompose_str(in,i_nfd2nfc) -#define precompose_argv(c,v) -#define probe_utf8_pathname_composition(p) +static inline void precompose_argv(int, const char **); +static inline void probe_utf8_pathname_composition(struct strbuf *buf) +{ + ; /* no-op */ +} #endif #ifdef MKDIR_WO_TRAILING_SLASH