Skip to content

Commit 1c301e4

Browse files
authored
Merge pull request #274 from elbeno/add-clang-21
👷 Add clang-21 to CI
2 parents b4ce17a + ce7f0f8 commit 1c301e4

9 files changed

Lines changed: 33 additions & 29 deletions

File tree

.github/workflows/unit_tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
DEBIAN_FRONTEND: noninteractive
1414
CMAKE_GENERATOR: Ninja
1515
DEFAULT_CXX_STANDARD: 20
16-
DEFAULT_LLVM_VERSION: 20
16+
DEFAULT_LLVM_VERSION: 21
1717
DEFAULT_GCC_VERSION: 14
1818
MULL_LLVM_VERSION: 18
1919
MULL_VERSION: 0.26.1
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
compiler: [clang, gcc]
33-
version: [12, 13, 14, 16, 17, 18, 19, 20]
33+
version: [12, 13, 14, 16, 17, 18, 19, 20, 21]
3434
cxx_standard: [17, 20]
3535
stdlib: [libstdc++, libc++]
3636
build_type: [Debug]
@@ -39,6 +39,15 @@ jobs:
3939
cc: "clang"
4040
cxx: "clang++"
4141
cxx_flags: "-stdlib=libstdc++"
42+
- version: 21
43+
compiler: clang
44+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 21
45+
toolchain_root: "/usr/lib/llvm-21"
46+
- version: 21
47+
compiler: clang
48+
stdlib: libc++
49+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 21 && sudo apt install -y libc++-21-dev libc++abi-21-dev
50+
cxx_flags: "-stdlib=libc++"
4251
- version: 20
4352
compiler: clang
4453
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20
@@ -104,6 +113,8 @@ jobs:
104113
cxx: "g++-12"
105114
cxx_flags: ""
106115
exclude:
116+
- compiler: gcc
117+
version: 21
107118
- compiler: gcc
108119
version: 20
109120
- compiler: gcc

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Some of the extras are available only with C++20 or later.
1111

1212
*stdx* supports:
1313

14-
- clang 14 through 20
14+
- clang 14 through 21
1515
- gcc 12 through 14
1616

1717
See the [full documentation](https://intel.github.io/cpp-std-extensions/).

docs/intro.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The following compilers are supported:
2323
* clang 18
2424
* clang 19
2525
* clang 20
26+
* clang 21
2627
* gcc 12
2728
* gcc 13
2829
* gcc 14

include/stdx/compiler.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#ifndef CONSTINIT
66
#ifndef __cpp_constinit
7-
#if defined(__clang__)
7+
#ifdef __clang__
88
#define CONSTINIT [[clang::require_constant_initialization]]
99
#else
1010
#define CONSTINIT
@@ -23,15 +23,15 @@
2323
#endif
2424

2525
#ifndef CONSTEVAL_UDL
26-
#if defined(__clang__)
26+
#ifdef __clang__
2727
#define CONSTEVAL_UDL constexpr
2828
#else
2929
#define CONSTEVAL_UDL CONSTEVAL
3030
#endif
3131
#endif
3232

3333
#ifndef USING_ATTR_NS
34-
#if defined(__clang__)
34+
#ifdef __clang__
3535
#define USING_ATTR_NS using clang:
3636
#else
3737
#define USING_ATTR_NS using gnu:
@@ -51,31 +51,31 @@
5151
#endif
5252

5353
#ifndef MUSTTAIL
54-
#if defined(__clang__)
54+
#ifdef __clang__
5555
#define MUSTTAIL [[clang::musttail]]
5656
#else
5757
#define MUSTTAIL
5858
#endif
5959
#endif
6060

6161
#ifndef LIFETIMEBOUND
62-
#if defined(__clang__)
62+
#ifdef __clang__
6363
#define LIFETIMEBOUND [[clang::lifetimebound]]
6464
#else
6565
#define LIFETIMEBOUND
6666
#endif
6767
#endif
6868

6969
#define STDX_DO_PRAGMA(X) _Pragma(#X)
70-
#if defined(__clang__)
70+
#ifdef __clang__
7171
#define STDX_PRAGMA(X) STDX_DO_PRAGMA(clang X)
7272
#else
7373
#define STDX_PRAGMA(X) STDX_DO_PRAGMA(GCC X)
7474
#endif
7575

7676
#ifndef STDX_DELETED
7777
#if __cpp_deleted_function >= 202403L
78-
#if defined(__clang__)
78+
#ifdef __clang__
7979
#define STDX_DELETED(R) \
8080
STDX_PRAGMA(diagnostic push) \
8181
STDX_PRAGMA(diagnostic ignored "-Wunknown-warning-option") \

include/stdx/ct_conversions.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <stdx/compiler.hpp>
4+
#include <stdx/type_traits.hpp>
45

56
#include <cstddef>
67
#include <string_view>
@@ -9,14 +10,15 @@ namespace stdx {
910
inline namespace v1 {
1011
template <typename Tag>
1112
CONSTEVAL static auto type_as_string() -> std::string_view {
12-
#if defined(__clang__)
13+
#ifdef __clang__
1314
constexpr std::string_view function_name = __PRETTY_FUNCTION__;
1415
constexpr auto rhs = function_name.size() - 2;
1516
#elif defined(__GNUC__) || defined(__GNUG__)
1617
constexpr std::string_view function_name = __PRETTY_FUNCTION__;
1718
constexpr auto rhs = function_name.size() - 51;
1819
#else
19-
static_assert(false, "Unknown compiler, can't build type name.");
20+
static_assert(always_false_v<Tag>,
21+
"Unknown compiler, can't build type name.");
2022
#endif
2123

2224
constexpr auto lhs = function_name.rfind('=', rhs) + 2;
@@ -25,14 +27,15 @@ CONSTEVAL static auto type_as_string() -> std::string_view {
2527

2628
template <auto Value>
2729
CONSTEVAL static auto enum_as_string() -> std::basic_string_view<char> {
28-
#if defined(__clang__)
30+
#ifdef __clang__
2931
constexpr std::string_view value_string = __PRETTY_FUNCTION__;
3032
constexpr auto rhs = value_string.size() - 2;
3133
#elif defined(__GNUC__) || defined(__GNUG__)
3234
constexpr std::string_view value_string = __PRETTY_FUNCTION__;
3335
constexpr auto rhs = value_string.size() - 2;
3436
#else
35-
static_assert(false, "Unknown compiler, can't build type name.");
37+
static_assert(always_false_v<Tag>,
38+
"Unknown compiler, can't build type name.");
3639
#endif
3740

3841
constexpr auto lhs = [&]() -> std::string_view::size_type {

include/stdx/panic.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ auto panic(Args &&...args) -> void {
3535

3636
#if __cplusplus >= 202002L
3737
#define STDX_PANIC(MSG, ...) \
38-
[] { \
38+
[]() -> void { \
3939
using stdx::ct_string_literals::operator""_cts; \
4040
stdx::panic<MSG##_cts>(__VA_ARGS__); \
4141
}()

include/stdx/static_assert.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace stdx {
1010
inline namespace v1 {
11+
namespace detail {
1112
struct ct_check_value {};
1213

1314
template <bool B> struct ct_check_t {
@@ -22,6 +23,7 @@ template <> struct ct_check_t<true> {
2223
}
2324
};
2425
template <bool B> constexpr auto ct_check = ct_check_t<B>{};
26+
} // namespace detail
2527
} // namespace v1
2628
} // namespace stdx
2729

@@ -45,7 +47,7 @@ template <bool B> constexpr auto ct_check = ct_check_t<B>{};
4547
#define STATIC_ASSERT(cond, ...) \
4648
[&]<bool B>() -> bool { \
4749
constexpr auto S = STDX_CT_FORMAT(__VA_ARGS__); \
48-
stdx::ct_check<B>.template emit<S>(); \
50+
stdx::detail::ct_check<B>.template emit<S>(); \
4951
return B; \
5052
}.template operator()<cond>()
5153
#endif

test/fail/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ function(add_test_by_compiler CPP_NAME CXX_VERSION COMPILER_ID COMPILER_VERSION)
5555
endif()
5656
endfunction()
5757

58-
add_test_by_compiler(ct_check 20 Clang 15)
59-
add_test_by_compiler(ct_check 20 GNU 13.2)
6058
add_test_by_compiler(static_assert 20 Clang 15)
6159
add_test_by_compiler(static_assert 20 GNU 13.2)
6260
add_test_by_compiler(static_assert_format 20 Clang 15)

test/fail/ct_check.cpp

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)