[Scons-users] CPPDEFINES Unexpected Behavior
Managan, Rob
managan1 at llnl.gov
Thu Apr 11 15:35:41 EDT 2013
Dirk,
I don't think it is quite that simple. I agree with you for these two cases:
env = Environment(CPPDEFINES={'def1':23, 'def2':None})
Gives an env.Dump with:
'CPPDEFINES': { 'def1': 23, 'def2': None},
and an execute line of:
gcc -o sample.o -c -Ddef1=23 -Ddef2 sample.c
as you stated.
Similarly,
env = Environment()
env.AppendUnique(CPPDEFINES={'def1':23, 'def2':None})
results in the same thing.
==============
However,
env = Environment(CPPDEFINES={'def1':23, 'def2':None})
env.AppendUnique(CPPDEFINES=['def3=4'])
results in an env.Dump of:
'CPPDEFINES': [('def2', None), ('def1', 23), ('def3=4',)],
And an execute line of
gcc -o sample.o -c -Ddef2=None -Ddef1=23 -Ddef3=4 sample.c
Admittedly a contrived example but it seems that if you add anything to CPPDEFINES it gets converted to a list and something in the subset goes wrong.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Rob Managan email managan at llnl.gov
LLNL phone: 925-423-0903
P.O. Box 808, L-095 FAX: 925-422-3389
Livermore, CA 94551-0808
On 4/11/13 10:44 AM, "Dirk Bächle" <tshortik at gmx.de<mailto:tshortik at gmx.de>> wrote:
Hi all,
On 11.04.2013 17:27, Managan, Rob wrote:
I have a quick fix for the case
Env.AppendUnique(CPPDEFINES={'test1':3, 'test2':None})
I looked at the code a bit more and the behaviour reported by Kyle is not a bug, it's correct!
The point here is, that the "$CPPDEFINES" get expanded and used only when "$_CCCOMCOM" is substituted during an actual compile.
For the given example this can be enforced by:
env = Environment()
newdefs = {'def1' : None}
env.AppendUnique(CPPDEFINES=newdefs)
print env.subst('$_CPPDEFFLAGS')
which results in the correct output:
-Ddef1
It's simply the difference between setting "$CPPDEFINES", and actually expanding it. This also explains why Evan reported that he never seemed to have any problems while using this feature.
@Kyle: Please check and confirm this on your side, I'd then close the bug as INVALID.
Best regards,
Dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130411/f2139cbc/attachment.html>
More information about the Scons-users
mailing list