Skip to content

Commit 85fb289

Browse files
committed
provenance comment
1 parent eb53b30 commit 85fb289

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

include/boost/multi/adaptors/thrust/test/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ if(NOT Boost_FOUND)
2929
endif()
3030

3131
set(TEST_SRCS
32-
array.cu
33-
memory_resource.cu
32+
array.cu
33+
memory_resource.cu
3434
run_reduce.cu
3535
set_identity_kernel.cu
36-
speed.cu
37-
speed_algo.cu
38-
universal.cu
36+
speed.cu
37+
speed_algo.cu
38+
universal.cu
3939
vector.cu
4040
)
4141

include/boost/multi/array_ref.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ struct subarray_ptr // NOLINT(fuchsia-multiple-inheritance) : to allow mixin CR
431431
std::enable_if_t<!std::is_base_of_v<subarray_ptr, subarray_ptr<OtherT, OtherD, OtherEPtr, OtherL, OtherIsConst>>, int> =0 // NOLINT(modernize-use-constraints) TODO(correaa) for C++20
432432
>
433433
friend BOOST_MULTI_HD constexpr auto operator==(subarray_ptr const& self, subarray_ptr<OtherT, OtherD, OtherEPtr, OtherL, OtherIsConst> const& other) -> bool {
434-
assert((!self || !other) || (self->layout() == other->layout()));
434+
assert((!self || !other) || (self->layout() == other->layout())); // comparing array ptrs of different provenance is undefined
435435
return self->base() == other->base();
436436
}
437437

@@ -440,7 +440,7 @@ struct subarray_ptr // NOLINT(fuchsia-multiple-inheritance) : to allow mixin CR
440440
std::enable_if_t<!std::is_base_of_v<subarray_ptr, subarray_ptr<OtherT, OtherD, OtherEPtr, OtherL, OtherIsConst>>, int> =0 // NOLINT(modernize-use-constraints) TODO(correaa) for C++20
441441
>
442442
friend BOOST_MULTI_HD constexpr auto operator!=(subarray_ptr const& self, subarray_ptr<OtherT, OtherD, OtherEPtr, OtherL, OtherIsConst> const& other) -> bool {
443-
assert((!self || !other) || (self->layout() == other->layout()));
443+
assert((!self || !other) || (self->layout() == other->layout())); // comparing array ptrs of different provenance is undefined
444444
return self->base() != other->base();
445445
}
446446

test/array_ptr.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// Distributed under the Boost Software License, Version 1.0.
44
// https://www.boost.org/LICENSE_1_0.txt
55

6-
#include <boost/core/lightweight_test.hpp>
7-
86
#include <boost/multi/array.hpp> // for layout_t, apply, subarray, array... // IWYU pragma: keep // bug in iwyu 8.22
97

8+
#include <boost/core/lightweight_test.hpp>
9+
1010
#include <algorithm> // for equal
1111
#include <array> // for array // IWYU pragma: keep // bug in iwyu 8.22
1212
#include <memory> // for addressof
@@ -25,11 +25,11 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
2525
namespace multi = boost::multi;
2626

2727
#ifndef _MSC_VER // MSVC 14.40 is not constexpr ready?
28-
// BOOST_AUTO_TEST_CASE(constexpr_ptr_access) {
29-
// static constexpr auto test = [] {
30-
// std::array<int, 12> buffer{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
31-
// multi::array_ref<int, 2> arr({3, 3}, buffer.data());
32-
// auto ptr = &arr;
28+
// BOOST_AUTO_TEST_CASE(constexpr_ptr_access) {
29+
// static constexpr auto test = [] {
30+
// std::array<int, 12> buffer{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
31+
// multi::array_ref<int, 2> arr({3, 3}, buffer.data());
32+
// auto ptr = &arr;
3333

3434
// return (ptr->base() == buffer.data());
3535
// }();
@@ -90,15 +90,15 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
9090
BOOST_TEST( &std::as_const(arr)[2] == &ac2 );
9191
BOOST_TEST( &ac2 == & arr [2] );
9292

93-
// auto pac2 = &ac2;
94-
// auto parr2 = &arr[2];
95-
// BOOST_TEST( pac2 == parr2 );
93+
auto pac2 = &ac2;
94+
auto parr2 = &arr[2];
95+
BOOST_TEST( pac2 == parr2 );
9696

97-
// pac2 = nullptr;
98-
// BOOST_TEST( pac2 != parr2 );
97+
pac2 = nullptr;
98+
BOOST_TEST( pac2 != parr2 );
9999

100-
// parr2 = nullptr;
101-
// BOOST_TEST( pac2 == parr2 );
100+
parr2 = nullptr;
101+
BOOST_TEST( pac2 == parr2 );
102102
}
103103

104104
BOOST_AUTO_TEST_CASE(subarray_ptr_1D) {
@@ -219,17 +219,17 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
219219

220220
using my_span = multi::array_ref<int, 1>;
221221

222-
#if defined(__clang__)
223-
#pragma clang diagnostic push
224-
#pragma clang diagnostic ignored "-Wunknown-warning-option"
225-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
226-
#endif
222+
#if defined(__clang__)
223+
# pragma clang diagnostic push
224+
# pragma clang diagnostic ignored "-Wunknown-warning-option"
225+
# pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
226+
#endif
227227

228228
auto aP = &my_span{vec.data() + 2, {5}}; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
229229

230-
#if defined(__clang__)
231-
#pragma clang diagnostic pop
232-
#endif
230+
#if defined(__clang__)
231+
# pragma clang diagnostic pop
232+
#endif
233233

234234
BOOST_TEST( (*aP).size() == 5 );
235235
BOOST_TEST( aP->size() == 5 ); // doesn't work on MSVC?

0 commit comments

Comments
 (0)