Skip to content

Commit 422d66e

Browse files
committed
Get rid of BOUNDED_ASSUME(...) in favor of [[assume(...)]]
1 parent 0fb0a8d commit 422d66e

File tree

5 files changed

+4
-53
lines changed

5 files changed

+4
-53
lines changed

source/bounded/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ target_sources(bounded_test PRIVATE
123123
FILES
124124
test/assert.cpp
125125
test/assert-NDEBUG.cpp
126-
test/assume.cpp
127126
test/check_in_range.cpp
128127
test/comparison.cpp
129128
test/conditional.cpp

source/bounded/include/bounded/assert.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
#include <std_module/prelude.hpp>
1010

11-
#include <bounded/assume.hpp>
12-
1311
#include <cassert>
1412

1513
import bounded.constexpr_only_if;
1614
import bounded.prevent_comma;
1715

16+
import std_module;
17+
1818
// An expression of type `void`. This is used to allow using variadic
1919
// function-like macros to support expressions that contain commas, such as
2020
// `BOUNDED_ASSERT(f<a, b>())`, but prevents expressions that look like two
@@ -25,7 +25,7 @@ import bounded.prevent_comma;
2525

2626
#if defined NDEBUG or defined BOUNDED_NDEBUG
2727
#define BOUNDED_ASSERT(...) (std::is_constant_evaluated() ? ::bounded::detail::constexpr_only_if(__VA_ARGS__) : void())
28-
#define BOUNDED_ASSERT_OR_ASSUME BOUNDED_ASSUME
28+
#define BOUNDED_ASSERT_OR_ASSUME(...) [[assume(__VA_ARGS__)]]
2929
#else
3030
#define BOUNDED_ASSERT(...) (BOUNDED_DETAIL_PREVENT_COMMA(__VA_ARGS__), assert((__VA_ARGS__)))
3131
#define BOUNDED_ASSERT_OR_ASSUME BOUNDED_ASSERT

source/bounded/include/bounded/assume.hpp

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

source/bounded/integer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct integer {
178178
using underlying_type = underlying_type_t<minimum, maximum>;
179179

180180
constexpr auto value() const -> underlying_type {
181-
BOUNDED_ASSUME(minimum <= m_value and m_value <= maximum);
181+
[[assume(minimum <= m_value and m_value <= maximum)]];
182182
return m_value;
183183
}
184184

source/bounded/test/assume.cpp

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

0 commit comments

Comments
 (0)