}
function check-cxx-cxxabi() {
+ echo "--- Installing libc++ and libc++abi to a fake location"
+ ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
+
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
echo "+++ Running the libc++abi tests"
${NINJA} -vC "${BUILD_DIR}" check-cxxabi
-
- echo "--- Installing libc++ and libc++abi to a fake location"
- ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
}
# TODO: The goal is to test this against all configurations. We should also move
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
check-cxx-cxxabi
;;
+generic-static)
+ export CC=clang
+ export CXX=clang++
+ clean
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
+ check-cxx-cxxabi
+;;
generic-32bit)
export CC=clang
export CXX=clang++
export CC=gcc
export CXX=g++
clean
- # FIXME: Re-enable experimental testing on GCC. GCC cares about the order
- # in which we link -lc++experimental, which causes issues.
- generate-cmake -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
+ generate-cmake
check-cxx-cxxabi
;;
generic-asan)
return {m: int(v.rstrip('LlUu')) for (m, v) in allMacros.items() if m.startswith('__cpp_')}
-def _addToSubstitution(substitutions, key, value):
+def _appendToSubstitution(substitutions, key, value):
return [(k, v + ' ' + value) if k == key else (k, v) for (k, v) in substitutions]
+def _prependToSubstitution(substitutions, key, value):
+ return [(k, value + ' ' + v) if k == key else (k, v) for (k, v) in substitutions]
+
class ConfigAction(object):
"""
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{flags}}'.format(self._getFlag(config))
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable compile flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{compile_flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{compile_flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{compile_flags}}'.format(self._getFlag(config))
class AddLinkFlag(ConfigAction):
"""
- This action adds the given flag to the %{link_flags} substitution.
+ This action appends the given flag to the %{link_flags} substitution.
+
+ The flag can be a string or a callable, in which case it is called with the
+ configuration to produce the actual flag (as a string).
+ """
+ def __init__(self, flag):
+ self._getFlag = lambda config: flag(config) if callable(flag) else flag
+
+ def applyTo(self, config):
+ flag = self._getFlag(config)
+ assert hasCompileFlag(config, flag), "Trying to enable link flag {}, which is not supported".format(flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{link_flags}', flag)
+
+ def pretty(self, config, litParams):
+ return 'append {} to %{{link_flags}}'.format(self._getFlag(config))
+
+
+class PrependLinkFlag(ConfigAction):
+ """
+ This action prepends the given flag to the %{link_flags} substitution.
The flag can be a string or a callable, in which case it is called with the
configuration to produce the actual flag (as a string).
def applyTo(self, config):
flag = self._getFlag(config)
assert hasCompileFlag(config, flag), "Trying to enable link flag {}, which is not supported".format(flag)
- config.substitutions = _addToSubstitution(config.substitutions, '%{link_flags}', flag)
+ config.substitutions = _prependToSubstitution(config.substitutions, '%{link_flags}', flag)
def pretty(self, config, litParams):
- return 'add {} to %{{link_flags}}'.format(self._getFlag(config))
+ return 'prepend {} to %{{link_flags}}'.format(self._getFlag(config))
class AddOptionalWarningFlag(ConfigAction):
flag = self._getFlag(config)
# Use -Werror to make sure we see an error about the flag being unsupported.
if hasCompileFlag(config, '-Werror ' + flag):
- config.substitutions = _addToSubstitution(config.substitutions, '%{compile_flags}', flag)
+ config.substitutions = _appendToSubstitution(config.substitutions, '%{compile_flags}', flag)
def pretty(self, config, litParams):
return 'add {} to %{{compile_flags}}'.format(self._getFlag(config))