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

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 6 09:53:19 PDT 2021


curdeius marked 4 inline comments as done.
curdeius added inline comments.


================
Comment at: libcxx/utils/libcxx/test/params.py:55
   # Core parameters of the test suite
-  Parameter(name='std', choices=_allStandards, type=str,
+  Parameter(name='std', choices=list(_allStandards.keys()) + list(_allStandards.values()), type=str,
             help="The version of the standard to compile the test suite with.",
----------------
We need to have both keys and values here to allow fallbacks.

I'll land it with this suggestion but I don't want to trigger yet another CI only for this (given that the choices is visible only when the user provides a bad argument to `--param=std`, it isn't really tested anyway).


================
Comment at: libcxx/utils/libcxx/test/params.py:57
             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)[1],
             actions=lambda std: [
----------------
The default needs to be `[1]` because we don't want to use `-std=c++20` on the compiler that supports only `-std=c++2a`.


================
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())
----------------
ldionne wrote:
> 
I've kept `c++1z` as I sometimes use oldish gcc (e.g. cross-compiling for AVR). Hope that doesn't bother.


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