Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions libcxx/docs/TestingLibcxx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,38 @@ writing tests easier. See `libc++-specific Lit Directives`_ for more information
extension.)


C++ Standard version tests
~~~~~~~~~~~~~~~~~~~~~~~~~~

Historically libc++ tests used to filter the tests for C++ Standard versions
with lit directives like:

.. code-block:: cpp

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23

With C++ Standards released every 3 years, this solution is not scalable.
Instead use:

.. code-block:: cpp

// UNSUPPORTED: std-at-least-c++26

There is no corresponding ``std-at-most-c++23``. This could be useful when
tests are only valid for a small set of standard versions. For example, a
deprecation test is only valid when the feature is deprecated until it is
removed from the Standard. These tests should be written like:

.. code-block:: cpp

// REQUIRES: c++17 || c++20 || c++23

.. note::

There are a lot of tests with the first style, these can remain as they are.
The new style is only intended to be used for new tests.


Benchmarks
==========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// REQUIRES: std-at-least-c++23
// UNSUPPORTED: no-filesystem
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// REQUIRES: std-at-least-c++23
// UNSUPPORTED: no-filesystem
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++26
// REQUIRES: c++17 || c++20 || c++23
// UNSUPPORTED: no-wide-characters

// <codecvt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++26
// REQUIRES: c++17 || c++20 || c++23

// XFAIL: no-wide-characters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT

// UNSUPPORTED: c++03, c++11, c++14, c++26
// REQUIRES: c++17 || c++20 || c++23
// UNSUPPORTED: no-wide-characters

// <codecvt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// void reserve(); // Deprecated in C++20

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++26
// REQUIRES: c++20 || c++23

#include <string>

Expand Down
3 changes: 2 additions & 1 deletion libcxx/utils/libcxx/test/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def getSuitableClangTidy(cfg):
AddFeature(std),
AddSubstitution("%{cxx_std}", re.sub(r"\+", "x", std)),
AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
],
]
+ [AddFeature(f"std-at-least-{s}") for s in _allStandards if s <= std],
),
Parameter(
name="optimization",
Expand Down
Loading