Multiple past issues (see for example #2300) has caused env.Append and env.AppendUnique to grow special-case code for handling CPPDEFINES. One simple example of the special-casing is that normally Appending a string value to a string-valued consvar causes the strings to be concatenated, but for CPPDEFINES, they must remain two separate strings, so the variable is converted to a list and the new string added to the list.
This is a collective issue to document several problems.
env.Append(CPPDEFINES = [{'FAT32':1}])
env.Append(CPPDEFINES = [{'ZLIB':1}])
del env['CPPDEFINES']
env.AppendUnique(CPPDEFINES = [{'FAT32':1}])
env.AppendUnique(CPPDEFINES = [{'ZLIB':1}])
which if run with prints after each append shows:
env['CPPDEFINES']=[{'FAT32': 1}]
env['CPPDEFINES']=[{'FAT32': 1}, {'ZLIB': 1}]
env['CPPDEFINES']=[{'FAT32': 1}]
env['CPPDEFINES']=[({'FAT32': 1},), ({'ZLIB': 1},)]
that is, the AppendUnique case has tuple-ified the CPPDEFINES elements while the Append case has not.
Multiple past issues (see for example #2300) has caused
env.Appendandenv.AppendUniqueto grow special-case code for handlingCPPDEFINES. One simple example of the special-casing is that normallyAppending a string value to a string-valued consvar causes the strings to be concatenated, but forCPPDEFINES, they must remain two separate strings, so the variable is converted to a list and the new string added to the list.This is a collective issue to document several problems.
AppendandAppendUnique, but not for the parallelPrependandPrependUnique, meaning one set can have differing result types from the other.CPPDEFINEShandling. They are tested in e2e tests so this may not be a huge problem, but it seems an inconsistency, at least. And the e2e tests only test Append functions.AppendUniquedoes not handle in the same way the case where both existing and added are list types. There's at least one case where this leads to different results, as in the example snippets below:which if run with prints after each append shows:
that is, the
AppendUniquecase has tuple-ified theCPPDEFINESelements while theAppendcase has not.