[libcxx-commits] [PATCH] D99177: [libcxx] [test] Fix testing on windows with c++experimental enabled
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 23 08:11:24 PDT 2021
mstorsjo added a comment.
In D99177#2644842 <https://reviews.llvm.org/D99177#2644842>, @ldionne wrote:
> Can we try detecting MSVC this way instead:
>
> diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
> index e54cecef0ab8..2fb7e003ce03 100644
> --- a/libcxx/utils/libcxx/test/features.py
> +++ b/libcxx/utils/libcxx/test/features.py
> @@ -14,6 +14,8 @@ import sys
> _isClang = lambda cfg: '__clang__' in compilerMacros(cfg) and '__apple_build_version__' not in compilerMacros(cfg)
> _isAppleClang = lambda cfg: '__apple_build_version__' in compilerMacros(cfg)
> _isGCC = lambda cfg: '__GNUC__' in compilerMacros(cfg) and '__clang__' not in compilerMacros(cfg)
> +_isMSVC = lambda cfg: '_MSC_VER' in compilerMacros(cfg)
> +_msvcVersion = lambda cfg: (int(compilerMacros(cfg)['_MSC_VER']) // 100, int(compilerMacros(cfg)['_MSC_VER']) % 100)
>
> DEFAULT_FEATURES = [
> Feature(name='fcoroutines-ts',
> @@ -81,6 +83,10 @@ DEFAULT_FEATURES = [
> Feature(name=lambda cfg: 'gcc-{__GNUC__}'.format(**compilerMacros(cfg)), when=_isGCC),
> Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}'.format(**compilerMacros(cfg)), when=_isGCC),
> Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}'.format(**compilerMacros(cfg)), when=_isGCC),
> +
> + Feature(name='msvc', when=_isMSVC),
> + Feature(name=lambda cfg: 'msvc-{}'.format(*_msvcVersion(cfg)), when=_isMSVC),
> + Feature(name=lambda cfg: 'msvc-{}.{}'.format(*_msvcVersion(cfg)), when=_isMSVC),
> ]
>
> # Deduce and add the test features that that are implied by the #defines in
>
> I'm sure there's stuff to fix with that, but basically I'd rather add a new feature to detect msvc correctly all the time than hardcode it based on `windows`.
Thanks, I'll have a try with that to see if it works. As all parameters are evaluated before all features (in newconfig.configure), would these be set already at the point when we need them when handling a parameter?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99177/new/
https://reviews.llvm.org/D99177
More information about the libcxx-commits
mailing list