[libcxx-commits] [PATCH] D99789: [libc++] Add fallback standard flags and normalize corresponding feature.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 6 08:38:39 PDT 2021


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

The patch looks good to me, but I think we can simplify the implementation in `params.py` a bit IMO. I left some comments to that effect.

I also agree with the list of things to do when a new standard comes out - do you think it would be possible to document it somewhere? Maybe in `Contributing.rst`?



================
Comment at: libcxx/utils/libcxx/test/params.py:45-53
+def getLatestStdFlag(cfg):
+  for s in reversed(_allStandards):
+    if hasCompileFlag(cfg, '-std='+s):
+      return s
+    if s in _standardFallback:
+      fs = _standardFallback[s]
+      if hasCompileFlag(cfg, '-std='+fs):
----------------



================
Comment at: libcxx/utils/libcxx/test/params.py:58-62
+  Parameter(name='std', choices=_allStandardsAndFallbacks, type=str,
             help="The version of the standard to compile the test suite with.",
-            default=lambda cfg: next(s for s in reversed(_allStandards) if hasCompileFlag(cfg, '-std='+s)),
+            default=lambda cfg: getLatestStdFlag(cfg),
             actions=lambda std: [
+              AddFeature(_undoStandardFallback[std] if std in _undoStandardFallback else std),
----------------



================
Comment at: libcxx/utils/libcxx/test/params.py:11-14
+_allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b']
+_standardFallback = {'c++11': 'c++0x', 'c++14': 'c++1y', 'c++17': 'c++1z', 'c++20': 'c++2a'}
+_undoStandardFallback = dict((v, k) for k, v in _standardFallback.items())
+_allStandardsAndFallbacks = _allStandards + list(_standardFallback.values())
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99789/new/

https://reviews.llvm.org/D99789



More information about the libcxx-commits mailing list