On Mon, Aug 01, 2016 at 09:49:36PM +0000, Eric Wong wrote:
> Changes from v1:
>
> * dropped stringify macro in favor for quoting in Makefile
> (diff below)
> I'm not sure I like this change, and might be inclined to
> go in the opposite direction of using the stringify macro
> more widely to simplify the Makefile; but that is a separate
> topic.
I think that's a dangerous direction. Try this:
-- >8 --
cat >foo.c <<\EOF
#include <stdio.h>
#define stringify_(x) #x
#define stringify(x) stringify_(x)
int main(void)
{
printf("%s", stringify(FOO));
return 0;
}
EOF
while read -r input; do
gcc -Wall -Werror -DFOO="$input" foo.c
./a.out
done
-- 8< --
and then try input like:
this has a lot of spaces
this has a \backslash
You should see:
this has a lot of spaces
this has aackslash
I'll grant that backslashes and runs of whitespace are not things we'd
expect to find in most of our build-time config, but it still seems like
a bad direction to go (and actually, I wouldn't be surprised if
backslashes do end up in some of our build-time variables on Windows).
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html