Opened 16 years ago

Closed 16 years ago

#729 closed Patches (Fixed)

jam:"VAR on TARGET ?= values" unconditionally assigns values

Reported by: markovitch Owned by: René Rivera
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

"VAR on TARGET ?= values" unconditionally assigns
values, i.e. works like "unconditional" assignment.
This bug is extremely insidious, since there is no hint
of wrong behaviour at all (it costed me a full day of
futile debugging of my jam script before it dawned upon
me that it is something wrong with assignment).
Interesting, that documentation actually doesn't
mention that "default assignment" is available on
target, i.e. this is a "feature", but this requires
_very_ attentive reading of documentation and is quite
inconsistent. And even so it is a bug: there should be
at least a syntax error!

There are two ways to fix this bug:

1. Bring code into sync with doc, i.e. patch the syntax
so that "VAR on TARGET ?= values" would be a syntax
error. IMO strange, inconsistent and inconvinient.

2. Patch addsettings so that it handled default
assignment correctly.

The proposed patch implements the latter approach. 
The addsettings() function now accepts "setflag"
(VAR_SET, VAR_ADD, VAR_DEFAULT) the same way as
var_set() does, instead of logical "append" parameter.
All addsettings() calls patched accordingly. 
Besides, it factors out the logic of converting
ASSIGN_XXX compilation flag into corresponding VAR_XXX
variable set flag into a separate static function.

The patch is against CVS HEAD.

Change History (3)

comment:1 by markovitch, 16 years ago

Summary: "VAR on TARGET ?= values" unconditionally assigns valuesFix:"VAR on TARGET ?= values" unconditionally assigns values

comment:2 by markovitch, 16 years ago

Summary: Fix:"VAR on TARGET ?= values" unconditionally assigns valuesjam:"VAR on TARGET ?= values" unconditionally assigns values

comment:3 by René Rivera, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=33595

Thanks for the patch :-)
Note: See TracTickets for help on using tickets.