Skip to content

Commit

Permalink
Avoid recursion involving configure_get_cxx_stdlib
Browse files Browse the repository at this point in the history
Making the default value of configure.cxx_stdlib depend on the value of
configure.cxx introduced a circular dependency, since get_compiler_fallback
checks configure.cxx_stdlib to decide whether to add certain compilers.

The way variable traces work seems to have made this behave more or
less correctly anyway (traces are temporarily removed while the
associated proc is being executed) but it's better to make the
behaviour explicit.

(cherry picked from commit 3d9d2e1)
  • Loading branch information
jmroot committed Jun 4, 2018
1 parent 2e76325 commit b9a973a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/port1.0/portconfigure.tcl
Expand Up @@ -523,7 +523,9 @@ proc portconfigure::configure_get_default_compiler {} {

# internal function to choose compiler fallback list based on platform
proc portconfigure::get_compiler_fallback {} {
global xcodeversion macosx_deployment_target default_compilers configure.sdkroot configure.cxx_stdlib os.major
global xcodeversion macosx_deployment_target default_compilers \
configure.sdkroot configure.cxx_stdlib cxx_stdlib os.major \
option_defaults

# Check our override
if {[info exists default_compilers]} {
Expand Down Expand Up @@ -581,7 +583,16 @@ proc portconfigure::get_compiler_fallback {} {
}

# Determine which versions of clang we prefer
if {${configure.cxx_stdlib} eq "libc++"} {
# There is a recursion trap here: the default value of configure.cxx_stdlib
# is determined by a proc that may end up calling us to find out which
# compiler is being used. So, bypass that if the option hasn't already
# been set to a particular value.
if {![info exists option_defaults(configure.cxx_stdlib)]} {
set our_stdlib ${configure.cxx_stdlib}
} else {
set our_stdlib $cxx_stdlib
}
if {$our_stdlib eq "libc++"} {
# clang-3.5+ require libc++
lappend compilers macports-clang-5.0 macports-clang-4.0

Expand Down Expand Up @@ -781,8 +792,7 @@ proc portconfigure::configure_main {args} {
configure.perl configure.python configure.ruby configure.install configure.awk configure.bison \
configure.pkg_config configure.pkg_config_path \
configure.ccache configure.distcc configure.cpp configure.javac configure.sdkroot \
configure.march configure.mtune configure.cxx_stdlib \
os.platform os.major
configure.march configure.mtune os.platform os.major
foreach tool {cc cxx objc objcxx f77 f90 fc ld} {
global configure.${tool} configure.${tool}_archflags
}
Expand Down

0 comments on commit b9a973a

Please sign in to comment.