From 62714ccce87c488bb6aac8aa1332eb26ca8fe732 Mon Sep 17 00:00:00 2001 From: Fred Wright Date: Mon, 24 Dec 2018 20:14:58 -0800 Subject: 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. --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index c0256e5d..6e6caf96 100644 --- a/SConstruct +++ b/SConstruct @@ -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) { -- cgit v1.2.1