|
From: | Greg McGary |
Subject: | controlled disabling of undefined variable warnings |
Date: | Sat, 14 Jun 2008 12:53:56 -0700 |
User-agent: | Thunderbird 2.0.0.14 (X11/20080501) |
Hi Paul, In an effort to find lingering bugs in my non-recursive framework, I used --warn-undefined-variables. As expected, I got a zillion warnings from the framework around constructed variable names. I wrote this little gadget: expand = $(if $(filter-out undefined,$(origin $(1))),$($(1))) and replaced references of $(foo $(bar)) with $(expand foo $(bar)) to suppress warnings. It was a useful exercise, since I found two bugs this way. The trouble was that it doubled my makefile-processing overhead. I really want to keep the warnings enabled, but I really don't want to pay the additional overhead. The obvious solution is another builtin function, like so: $(expand VARNAME) expands as $(VARNAME) if VARNAME is defined expands as the empty string if VARNAME is undefined, but without undefined variable warnings. "expand" is a rather bland name without distinction, though compact. Better might be: $(expand-without-warnings ...) or $(maybe-expand ...) What do you think? If I submitted a patch for this, would you add it to the next release? Greg |
[Prev in Thread] | Current Thread | [Next in Thread] |