diff options
author | Fred Wright <fw@fwright.net> | 2018-12-24 20:14:58 -0800 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2018-12-25 19:27:24 -0800 |
commit | 62714ccce87c488bb6aac8aa1332eb26ca8fe732 (patch) | |
tree | e9c2dcbd05b6966db69de9c06884a5351a43b3d5 /SConstruct | |
parent | da4a2b80309c541df26637d585a04acb346ec4e5 (diff) | |
download | gpsd-62714ccce87c488bb6aac8aa1332eb26ca8fe732.tar.gz |
Fixes unreliability in CheckCompilerOption().
The code to restore the old CFLAGS when an option test failed was
sometimes a victim of Python's "list by reference rather than value"
issue. The effect was that the removal of the failing option
sometimes didn't work. The bug was only observed when the build was
being run by MacPorts, for some unknown reason. This has apparently
been broken ever since the introduction of CheckCompilerOption(),
though it didn't cause trouble until "Wvla" was added to the option
list, where it broke builds on OSX 10.5 and 10.6, whose compilers
don't support the option.
The fix is simply to use the "[:]" construct to copy the list.
TESTED:
Tested both "bare" build and MacPorts "destroot" on MacPro 10.9, and
VMs for macOS 10.5-10.13. Failures on 10.5 and 10.6 are now gone.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -566,7 +566,7 @@ def CheckXsltproc(context): def CheckCompilerOption(context, option): context.Message('Checking if compiler accepts %s... ' % (option,)) - old_CFLAGS = context.env['CFLAGS'] + old_CFLAGS = context.env['CFLAGS'][:] # Get a *copy* of the old list context.env.Append(CFLAGS=option) ret = context.TryLink(""" int main(int argc, char **argv) { |