bfgroup / b2

B2 makes it easy to build C++ projects, everywhere.
https://www.bfgroup.xyz/b2/
Boost Software License 1.0
76 stars 228 forks source link

`if $(unset-var) in a b c` is always true #285

Open Kojoley opened 1 year ago

Kojoley commented 1 year ago
local a ;
if $(a) in q w e {
    ECHO "wtf" ;
}

prints

wtf

Is this intended to work this way? Maybe it has some good uses, but I can't think of one. And $(a:E=) as a workaround could hit you in the back too when right hand side is variable.

grafikrobot commented 5 months ago

I just ran into a situation where we rely on this functionality: https://github.com/bfgroup/b2/blob/main/src/build/targets.jam#L1259

And thinking about it, it makes sense. As the in operator is equivalent to "A is a subset of B".