Re: [PATCH 11/13] Makefile: auto-build C strings from make variables
- From
Jeff King <peff@peff.net>
- Date
- Feb 5, 2014, 19:20 UTC
- Message-ID
- <20140205192033.GB15489@sigill.intra.peff.net>
- In-Reply-To
- <xmqqeh3h4beu.fsf@gitster.dls.corp.google.com>
On Wed, Feb 05, 2014 at 11:17:13AM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > diff --git a/script/mkcstring b/script/mkcstring
> > new file mode 100644
> > index 0000000..c01f430
> > --- /dev/null
> > +++ b/script/mkcstring
> > @@ -0,0 +1,18 @@
> > +#!/bin/sh
> > +
> > +name=$1; shift
> > +
> > +c_quote() {
> > + sed 's/\\/\\\\/g; s/"/\\"/'
>
> No 'g' for the second one?That's a bug. Thanks for catching.
I tested most of these changes manually, but I missed this one by only testing a value with a single quote. At one point I had introduced:
$(eval $(call make-var,FOO,debug variable,$(FOO)))
so you could do "make MAKE/FOO" and "make MAKE/foo-string.c", but I did not include it in the series. Adding a test suite to our Makefile kind of seems like overkill, but as it gets complex, maybe some simple sanity checks are worthwhile (not part of the regular test suite, but maybe just a "./test-make" script to make sure it behaves). I dunno.
-Peff