From 720ce88a839cc9966d4b5dfbcdbe868c33cb5965 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 25 Sep 2019 20:25:06 +0200 Subject: Fix handling of parentheses in macro argument values As an oversight, there was no check for nested parentheses in macro arguments, making the preprocessor think the call ended after 'void)' in def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null) This broke the latest linux-next kernels, starting with commit eb111869301e1 ("compiler-types.h: add asm_inline definition"). I remember seeing this when going through the C code, but somehow forgot to put it in. Fix it, and clean up _expand_macro() a bit at the same time. Fixes: #76 --- tests/Kpreprocess | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Kpreprocess b/tests/Kpreprocess index e30b389..f9aca10 100644 --- a/tests/Kpreprocess +++ b/tests/Kpreprocess @@ -51,7 +51,7 @@ surround-rev-quote = $(0) $(rev-quote,$(1),$(2)) $(0) surround-rev-quote-unused-arg = $(surround-rev-quote,$(1),$(2)) $(3) # No value is passed for $(3), so it expands to nothing fn-indir = surround-rev-quote -messy-fn-res = $($(fn-indir)-unused-arg, a b , c d ) +messy-fn-res = $($(fn-indir)-unused-arg, a b (,) , c d ) # Special characters in function call comma = , @@ -121,6 +121,10 @@ shell-res = $(shell,false && echo foo bar || echo baz qaz) # Warns about output on stderr, expands to nothing shell-stderr-res := $(shell,echo message on stderr >&2) +# Nested parens in macro call. Should give a single argument. Test it with +# $(shell) to get a free argument number check. +parens-res = pre-$(shell,echo '(a,b,(c,d),e)')-post + # Expands to the current location location-res := $(filename):$(lineno) -- cgit v1.2.3