Hi Phillip, On Mon, 11 Sep 2023, Phillip Wood wrote: > On 31/08/2023 07:15, Johannes Schindelin via GitGitGadget wrote: > > From: Johannes Schindelin <johannes.schindelin@xxxxxx> > > > > Visual C interpolates `__FILE__` with the absolute _Windows_ path of > > the source file. GCC interpolates it with the relative path, and the > > tests even verify that. > > Oh, that's a pain > > > So let's make sure that the unit tests only emit such paths. > > Makes sense > > > +#ifndef _MSC_VER > > +#define make_relative(location) location > > +#else > > +/* > > + * Visual C interpolates the absolute Windows path for `__FILE__`, > > + * but we want to see relative paths, as verified by t0080. > > + */ > > +#include "strbuf.h" > > +#include "dir.h" > > + > > +static const char *make_relative(const char *location) > > +{ > > + static const char *prefix; > > + static size_t prefix_len; > > + static struct strbuf buf = STRBUF_INIT; > > So far test-lib.c avoids using things like struct strbuf that it will be used > to test. In this instance we're only using it on one particular compiler so it > may not matter so much. We could avoid it but I'm not sure it is worth the > extra complexity. One thing I noted in this patch is that prefix is leaked but > I'm not sure if you run any leak checkers on the msvc build. I changed the code not to use a strbuf, and I'm now working exclusively on static buffers instead of `malloc()`ing anything. Thank you, Johannes