Skip to content

Commit 99bff2c

Browse files
committed
feat all: use keywords instead of macro
Tests: протестировано CI commit_hash:d1dc9a5a885dc4f8a29fd13615e68a73e77323f0
1 parent 03fa336 commit 99bff2c

16 files changed

Lines changed: 16 additions & 45 deletions

File tree

.mapping.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5339,7 +5339,6 @@
53395339
"universal/include/userver/cache/lru_set.hpp":"taxi/uservices/userver/universal/include/userver/cache/lru_set.hpp",
53405340
"universal/include/userver/compiler/demangle.hpp":"taxi/uservices/userver/universal/include/userver/compiler/demangle.hpp",
53415341
"universal/include/userver/compiler/impl/asan.hpp":"taxi/uservices/userver/universal/include/userver/compiler/impl/asan.hpp",
5342-
"universal/include/userver/compiler/impl/constexpr.hpp":"taxi/uservices/userver/universal/include/userver/compiler/impl/constexpr.hpp",
53435342
"universal/include/userver/compiler/impl/lifetime.hpp":"taxi/uservices/userver/universal/include/userver/compiler/impl/lifetime.hpp",
53445343
"universal/include/userver/compiler/impl/lsan.hpp":"taxi/uservices/userver/universal/include/userver/compiler/impl/lsan.hpp",
53455344
"universal/include/userver/compiler/impl/three_way_comparison.hpp":"taxi/uservices/userver/universal/include/userver/compiler/impl/three_way_comparison.hpp",

core/include/userver/concurrent/impl/monotonic_concurrent_set.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <boost/atomic/atomic.hpp>
1616

17-
#include <userver/compiler/impl/constexpr.hpp>
1817
#include <userver/utils/assert.hpp>
1918
#include <userver/utils/impl/fused_allocations.hpp>
2019
#include <userver/utils/not_null.hpp>
@@ -94,7 +93,7 @@ struct Bucket {
9493
};
9594

9695
template <typename T>
97-
inline USERVER_IMPL_CONSTINIT Bucket<T> kNullBucket{};
96+
inline constinit Bucket<T> kNullBucket{};
9897

9998
template <typename T>
10099
struct Table {
@@ -162,7 +161,7 @@ struct Table {
162161
};
163162

164163
template <typename T>
165-
inline USERVER_IMPL_CONSTINIT Table<T> kNullTable{};
164+
inline constinit Table<T> kNullTable{};
166165

167166
} // namespace monotonic_concurrent_set
168167

core/include/userver/storages/query.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Query {
4242
// clang-16 and below lose (optimize out) the pointer to `literal` with consteval. Clang-18 is know to work
4343
constexpr
4444
#else
45-
USERVER_IMPL_CONSTEVAL
45+
consteval
4646
#endif
4747
NameLiteral(const char* literal) noexcept
4848
: zstring_view{literal} {

core/src/concurrent/impl/asymmetric_fence.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <atomic>
1010
#include <cstdint>
1111

12-
#include <userver/compiler/impl/constexpr.hpp>
1312
#include <userver/engine/task/task_processor_fwd.hpp>
1413
#include <userver/utils/assert.hpp>
1514

@@ -30,7 +29,7 @@ enum class MembarrierRegistrationStatus : std::uint8_t {
3029
kUnsupported,
3130
};
3231

33-
thread_local USERVER_IMPL_CONSTINIT auto thread_registration_status = MembarrierRegistrationStatus::kNotCheckedYet;
32+
thread_local constinit auto thread_registration_status = MembarrierRegistrationStatus::kNotCheckedYet;
3433

3534
bool IsMembarrierAvailable() noexcept {
3635
const auto ret = syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);

core/src/concurrent/impl/rseq.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#pragma GCC diagnostic pop
2929
#endif
3030

31-
#include <userver/compiler/impl/constexpr.hpp>
3231
#include <userver/utils/assert.hpp>
3332
#include <userver/utils/impl/static_registration.hpp>
3433

@@ -39,7 +38,7 @@ namespace concurrent::impl {
3938
inline constexpr std::size_t kRseqArraySizeUninitialized = -1;
4039
inline constexpr std::size_t kRseqArraySizeDisabled = 0;
4140

42-
inline USERVER_IMPL_CONSTINIT std::size_t rseq_array_size = kRseqArraySizeUninitialized;
41+
inline constinit std::size_t rseq_array_size = kRseqArraySizeUninitialized;
4342

4443
__attribute__((constructor)) inline std::size_t GetRseqArraySize() noexcept {
4544
if (rseq_array_size == kRseqArraySizeUninitialized) {

core/src/concurrent/impl/striped_array.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <memory> // for std::uninitialized_fill_n
66

7-
#include <userver/compiler/impl/constexpr.hpp>
87
#include <userver/compiler/impl/lsan.hpp>
98
#include <userver/concurrent/impl/intrusive_stack.hpp>
109

@@ -26,7 +25,7 @@ namespace {
2625
// IntrusiveStack degrades performance under contention.
2726
// Suppose that StripedArray's are not created-destroyed very often.
2827
using StripedArrayStorage = IntrusiveStack<StripedArrayNode, MemberHook<&StripedArrayNode::hook>>;
29-
USERVER_IMPL_CONSTINIT StripedArrayStorage striped_array_storage;
28+
constinit StripedArrayStorage striped_array_storage;
3029

3130
// To avoid static destruction order fiasco.
3231
static_assert(std::is_trivially_destructible_v<StripedArrayStorage>);

core/src/engine/task/cxxabi_eh_globals.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include <cxxabi.h>
66
#include <cstring>
77

8-
#include <userver/compiler/impl/constexpr.hpp>
9-
108
#include <engine/task/task_context.hpp>
119

1210
USERVER_NAMESPACE_BEGIN
@@ -17,7 +15,7 @@ namespace engine::impl {
1715

1816
// NOLINTNEXTLINE(hicpp-use-noexcept,modernize-use-noexcept)
1917
abi::__cxa_eh_globals* GetGlobals() throw() {
20-
USERVER_IMPL_CONSTINIT thread_local EhGlobals tls_globals;
18+
constinit thread_local EhGlobals tls_globals;
2119
auto* globals = &tls_globals;
2220

2321
auto* context = current_task::GetCurrentTaskContextUnchecked();

core/src/storages/query_test.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <userver/storages/query.hpp>
22

3-
#include <userver/compiler/impl/constexpr.hpp>
43
#include <userver/utest/utest.hpp>
54

65
USERVER_NAMESPACE_BEGIN
@@ -11,14 +10,14 @@ constexpr const char* kStatement = "The query that is too long to fit into SSO b
1110
constexpr const char* kQueryName = "query_name_that_does_not_fir_into_SSO_because_it_is_too_big";
1211

1312
// Validate that variable initializes without dynamic initialization
14-
USERVER_IMPL_CONSTINIT const storages::Query kStaticInit{
13+
constinit const storages::Query kStaticInit{
1514
kStatement,
1615
storages::Query::NameLiteral{kQueryName},
1716
storages::Query::LogMode::kFull,
1817
};
1918

2019
// Validate that variable initializes without dynamic initialization
21-
USERVER_IMPL_CONSTINIT const storages::Query kEmptyStaticInit{};
20+
constinit const storages::Query kEmptyStaticInit{};
2221

2322
} // namespace
2423

core/src/utils/impl/wait_token_storage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <utility>
77

88
#include <concurrent/impl/owning_intrusive_pool.hpp>
9-
#include <userver/compiler/impl/constexpr.hpp>
109
#include <userver/concurrent/impl/asymmetric_fence.hpp>
1110
#include <userver/concurrent/impl/intrusive_hooks.hpp>
1211
#include <userver/concurrent/impl/intrusive_stack.hpp>
@@ -36,7 +35,7 @@ using WaitTokenStorageImplPool = concurrent::impl::OwningIntrusivePool<concurren
3635
WaitTokenStorageImpl,
3736
concurrent::impl::MemberHook<&WaitTokenStorageImpl::pool_hook>>>;
3837

39-
USERVER_IMPL_CONSTINIT WaitTokenStorageImplPool wait_token_storage_impl_pool;
38+
constinit WaitTokenStorageImplPool wait_token_storage_impl_pool;
4039

4140
} // namespace
4241

universal/include/userver/compiler/impl/constexpr.hpp

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

0 commit comments

Comments
 (0)