[libcxx-commits] [libcxx] 8508b1c - [libc++] Divorce the std Lit feature from the -std=XXX compiler flag

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 12 08:55:45 PDT 2021


Author: Louis Dionne
Date: 2021-04-12T11:55:39-04:00
New Revision: 8508b1c133f6dea558fd62f73cf333bdec809026

URL: https://github.com/llvm/llvm-project/commit/8508b1c133f6dea558fd62f73cf333bdec809026
DIFF: https://github.com/llvm/llvm-project/commit/8508b1c133f6dea558fd62f73cf333bdec809026.diff

LOG: [libc++] Divorce the std Lit feature from the -std=XXX compiler flag

After this patch, we can use `--param std=c++20` even if the compiler only
supports -std=c++2a. The test suite will handle that for us. The only Lit
feature that isn't fully baked will always be the "in development" one,
since we don't know exactly what year the standard will be ratified in.

This is another take on https://reviews.llvm.org/D99789.

Differential Revision: https://reviews.llvm.org/D100210

Added: 
    

Modified: 
    libcxx/cmake/caches/Generic-cxx20.cmake
    libcxx/docs/TestingLibcxx.rst
    libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
    libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
    libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
    libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
    libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
    libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
    libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
    libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
    libcxx/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
    libcxx/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/Generic-cxx20.cmake b/libcxx/cmake/caches/Generic-cxx20.cmake
index 1a07a99563dcc..3c44fdaf0e425 100644
--- a/libcxx/cmake/caches/Generic-cxx20.cmake
+++ b/libcxx/cmake/caches/Generic-cxx20.cmake
@@ -1,2 +1,2 @@
-set(LIBCXX_TEST_PARAMS "std=c++2a" CACHE STRING "")
+set(LIBCXX_TEST_PARAMS "std=c++20" CACHE STRING "")
 set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")

diff  --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index 50aeb3e1b81d9..156249d359d03 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -126,7 +126,7 @@ default.
 
 .. option:: std=<standard version>
 
-  **Values**: c++03, c++11, c++14, c++17, c++2a, c++2b
+  **Values**: c++03, c++11, c++14, c++17, c++20, c++2b
 
   Change the standard version used when building the tests.
 

diff  --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
index e1a545cc98344..c6cacb4e1e40f 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
@@ -11,7 +11,7 @@
 // Note that sized delete operator definitions below are simply ignored
 // when sized deallocation is not supported, e.g., prior to C++14.
 
-// UNSUPPORTED: c++14, c++17, c++2a
+// REQUIRES: c++03 || c++11
 // UNSUPPORTED: sanitizer-new-delete
 
 #include <new>

diff  --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
index 69f8bce276715..3a904afc05009 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
@@ -11,7 +11,7 @@
 // Note that sized delete operator definitions below are simply ignored
 // when sized deallocation is not supported, e.g., prior to C++14.
 
-// UNSUPPORTED: c++14, c++17, c++2a
+// REQUIRES: c++03 || c++11
 // UNSUPPORTED: sanitizer-new-delete
 
 #include <new>

diff  --git a/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
index 740af169b74de..82c7268cf6639 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 

diff  --git a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
index 8a5780b4c73af..ccd3925b63fe0 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 

diff  --git a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
index 88d9b42027a1b..bb40adef8fdbe 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string>
 

diff  --git a/libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp b/libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
index 658e10d211820..a9fbe106e363d 100644
--- a/libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 

diff  --git a/libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp b/libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
index f22e77d38d061..06f0f782e0faf 100644
--- a/libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 

diff  --git a/libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
index 0b7976846173d..068b9df94fb43 100644
--- a/libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // <string_view>
 

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
index ad50755a00cd1..ca72af3883446 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // type_traits
 

diff  --git a/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp b/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
index 0b2bc199a8313..337b86ab8949a 100644
--- a/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
+++ b/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.pass.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // [utility.underlying], to_underlying
 // template <class T>

diff  --git a/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp b/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
index 9064ba4067c50..b1b2881d888f0 100644
--- a/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
+++ b/libcxx/test/std/utilities/utility/utility.underlying/to_underlying.verify.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2a
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // [utility.underlying], to_underlying
 // template <class T>

diff  --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 2ced9d04dc070..c6b47972a35ab 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -8,7 +8,6 @@
 
 from libcxx.test.dsl import *
 
-_allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++2a', 'c++2b']
 _warningFlags = [
   '-Werror',
   '-Wall',
@@ -38,14 +37,28 @@
   '-Wno-unused-local-typedef',
 ]
 
+_allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b']
+def getStdFlag(cfg, std):
+  fallbacks = {
+    'c++11': 'c++0x',
+    'c++14': 'c++1y',
+    'c++17': 'c++1z',
+    'c++20': 'c++2a',
+  }
+  if hasCompileFlag(cfg, '-std='+std):
+    return '-std='+std
+  if std in fallbacks and hasCompileFlag(cfg, '-std='+fallbacks[std]):
+    return '-std='+fallbacks[std]
+  return None
+
 DEFAULT_PARAMETERS = [
   # Core parameters of the test suite
   Parameter(name='std', choices=_allStandards, 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: next(s for s in reversed(_allStandards) if getStdFlag(cfg, s)),
             actions=lambda std: [
               AddFeature(std),
-              AddCompileFlag('-std={}'.format(std)),
+              AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
             ]),
 
   Parameter(name='enable_exceptions', choices=[True, False], type=bool, default=True,


        


More information about the libcxx-commits mailing list