Subject: make: fix modifiers in variables
To: None <tech-toolchain@netbsd.org>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 05/06/2006 00:31:23
Ok, I'm not including the patch - it is at 

http://www.crufty.net/ftp/pub/sjg/tmp/var.c.diff

and since it is unforunately large, the resulting var.c is there too -
might be easier to read.

It moves the bulk of modifier handling out of Var_Parse to a separate
function.  This seems to be the best way to handle modifiers in
variables.  

There are a couple of problems with the existing implementation that
didn't show up in simple test cases.  
1/ Var_Subst() was the wrong thing to use - doesn't matter in simple
   cases, but doesn't work well in loops - expands too much.
2/ Using Var_Parse() addresses #1, but doesn't address the issue that
   the accounting for text consumed ends up wrong.


Allowing the modifier code to call itself recursively seems to be the
best way to address the issues.  It also splits 1000 lines of code out
of Var_Parse() which isn't a bad thing either.

--sjg