[libcxx-commits] [PATCH] D99177: [libcxx] [test] Fix testing on windows with c++experimental enabled

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 23 07:46:51 PDT 2021


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

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`.


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