[C++] Ignore white space around $(call) function name
Regression when compared to GNU make behaviour.
Test case:
$ cat Makefile.call-func-name
func = $(info called with '$(1)')
test = $(call $(1),$(1))
$(call test,func)
$(call test, func)
$(call test,func )
$(call test, func )
$ make -f Makefile.call-func-name
called with 'func'
called with ' func'
called with 'func '
called with ' func '
make: *** No targets. Stop.
$ ckati -c --warn -f Makefile.call-func-name
called with 'func'
Makefile.call-func-name:5: *warning*: undefined user function: func
Makefile.call-func-name:6: *warning*: undefined user function: func
Makefile.call-func-name:5: *warning*: undefined user function: func
*** No targets.
Fixes https://github.com/google/kati/issues/49
Change-Id: I3d982cd8d6d9777034df64540c32846300cb72f2
diff --git a/func.cc b/func.cc
index 876b274..e313c9e 100644
--- a/func.cc
+++ b/func.cc
@@ -583,7 +583,7 @@
Intern("5"), Intern("6"), Intern("7"), Intern("8"), Intern("9")
};
- const string&& func_name = args[0]->Eval(ev);
+ const string&& func_name = TrimSpace(args[0]->Eval(ev)).as_string();
Var* func = ev->LookupVar(Intern(func_name));
if (!func->IsDefined()) {
KATI_WARN("%s:%d: *warning*: undefined user function: %s",