[Scons-users] CPPDEFINES Unexpected Behavior

Evan Driscoll driscoll at cs.wisc.edu
Wed Apr 10 17:13:48 EDT 2013


On 04/10/2013 02:48 PM, Strand, Kyle J wrote:> No, it doesn't, and it
shouldn't be expected to. That produces the def

> string "def1=", which, I suppose, might be better than "def1=None",

> but still isn't correct; it should simply be "def1".


FWIW, I basically always use CPPDEFINES as a dictionary, and the
behavior that Kyle wants is what I'd expect. In fact, I'm rather
surprised that I haven't exercised that functionality, as I thought I
had. :-)

I'd expect something like:
env['CPPDEFINES'] = { 'A': None, 'B': 1, 'C': 'Foo' }
to produce the command lines
... -DA -DB=1 -DC=Foo
... /DA /DB=1 /DC=Foo
as appropriate for the platform. (Alternatively, it could say -DA=1 and
/DA=1.)


On 04/10/2013 01:51 PM, Strand, Kyle J wrote:

> 1) When evaluating the CPPDEFINES variable, SCons should interpret

> ([def],None) the same way it interprets ([def],).

> 2) Functions such as AppendUnique() that alter the CPPDEFINES variable

> and accept a dictionary as an argument should interpret [def]:None

> key-value pairs in such a way as to store them "correctly," that is, as

> the tuple ([def],) in the CPPDEFINES list.


#2 would break some of my SConscripts, as I often set CPPDEFINES to a
dictionary then rely it as one. If my modifications of CPPDEFINES was
implicitly changed to a list of tuples, it would suddenly require a lot
of changes (in some cases, fairly significant changes).

#1 (special casing None) seems like the way to go to me.

Evan



More information about the Scons-users mailing list