Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 8647212

Browse files
Merge pull request #1139 from lukaszstolarczuk/merge-stable-1.10-into-stable-1.11
Merge stable-1.10 into stable-1.11
2 parents 2cecdec + bee0e4a commit 8647212

19 files changed

+120
-74
lines changed

.github/workflows/gha.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,29 @@ jobs:
1313
env:
1414
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
1515
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
16+
GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
1617
HOST_WORKDIR: /home/runner/work/libpmemobj-cpp/libpmemobj-cpp
1718
WORKDIR: utils/docker
1819
strategy:
1920
matrix:
2021
CONFIG: ["TYPE=debug OS=fedora OS_VER=32 PUSH_IMAGE=1",
2122
"TYPE=debug OS=ubuntu OS_VER=20.04 PUSH_IMAGE=1 CHECK_CPP_STYLE=1",
2223
"TYPE=debug OS=ubuntu OS_VER=20.04 COVERAGE=1",
23-
"TYPE=release OS=fedora OS_VER=32",
24+
"TYPE=release OS=fedora OS_VER=32 AUTO_DOC_UPDATE=1",
2425
"TYPE=release OS=ubuntu OS_VER=20.04",
2526
"TYPE=valgrind OS=ubuntu OS_VER=20.04",
2627
"TYPE=memcheck_drd OS=ubuntu OS_VER=20.04",
2728
"TYPE=package OS=fedora OS_VER=32",
28-
"TYPE=package OS=ubuntu OS_VER=20.04"]
29+
"TYPE=package OS=ubuntu OS_VER=20.04",
30+
"TYPE=coverity OS=ubuntu OS_VER=20.04"]
2931
steps:
3032
- name: Clone the git repo
3133
uses: actions/checkout@v2
3234
with:
33-
fetch-depth: 50
35+
fetch-depth: 0
3436

3537
- name: Pull or rebuild the image
36-
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh
38+
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh rebuild
3739

3840
- name: Run the build
3941
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
@@ -66,7 +68,7 @@ jobs:
6668
- name: Clone the git repo
6769
uses: actions/checkout@v2
6870
with:
69-
fetch-depth: 50
71+
fetch-depth: 0
7072
- name: Run the build
7173
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
7274
windows:
@@ -106,7 +108,7 @@ jobs:
106108
- name: Clone the git repo
107109
uses: actions/checkout@v2
108110
with:
109-
fetch-depth: 50
111+
fetch-depth: 0
110112

111113
- name: Install PMDK
112114
run: |

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
!.gitattributes
44
!.github/
55
!.clang-format
6-
!.travis.yml
76
!.mailmap
87
!.version
98
build/

.travis.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright 2018-2020, Intel Corporation
2+
# Copyright 2018-2021, Intel Corporation
33

44
cmake_minimum_required(VERSION 3.3)
55
project(libpmemobj-cpp C CXX)

ChangeLog

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
Tue Jul 06 2021 Łukasz Stolarczuk <[email protected]>
2+
3+
* Version 1.6.1
4+
5+
This release fixes minor bugs.
6+
7+
This is the last patch release for libpmemobj-cpp 1.6 version.
8+
Maintenance of this version is no longer supported.
9+
10+
Notable changes:
11+
- string: fix max_size() return value
12+
- allocation_flag: mark constructor as explicit
13+
- peristent_ptr: change ptr_offset_magic to be properly aligned
14+
- fix few headers' includes
15+
16+
Mon Jun 28 2021 Łukasz Stolarczuk <[email protected]>
17+
18+
* Version 1.5.2
19+
20+
This release fixes minor bugs.
21+
22+
This is the last patch release for libpmemobj-cpp 1.5 version.
23+
Maintenance of this version is no longer supported.
24+
25+
Notable changes:
26+
- operator[] for contiguous_iterator takes signed integral instead of
27+
unsigned
28+
- throw an exception when pmemobj_mutex_unlock fail
29+
- fix crash when a previous transaction failed to start because of
30+
already taken lock.
31+
132
Wed Sep 30 2020 Szymon Romik <[email protected]>
233

334
* Version 1.11
@@ -174,7 +205,7 @@ Fri Mar 15 2019 Igor Chorążewicz <[email protected]>
174205
- decrease number of persistent_ptr dereferences in
175206
make_persistent_array
176207

177-
Tue Feb 19 2018 Marcin Ślusarz <[email protected]>
208+
Tue Feb 19 2019 Marcin Ślusarz <[email protected]>
178209

179210
* Version 1.5.1
180211

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
libpmemobj-cpp
22
===============
33

4-
[![Build Status](https://travis-ci.org/pmem/libpmemobj-cpp.svg?branch=master)](https://travis-ci.org/pmem/libpmemobj-cpp)
54
[![Build status](https://github.com/pmem/libpmemobj-cpp/workflows/CPP/badge.svg)](https://github.com/pmem/libpmemobj-cpp/actions)
65
[![libpmemobj-cpp version](https://img.shields.io/github/tag/pmem/libpmemobj-cpp.svg)](https://github.com/pmem/libpmemobj-cpp/releases/latest)
76
[![Coverity Scan Build Status](https://scan.coverity.com/projects/15911/badge.svg)](https://scan.coverity.com/projects/pmem-libpmemobj-cpp)

include/libpmemobj++/container/detail/contiguous_iterator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: BSD-3-Clause
2-
/* Copyright 2018-2020, Intel Corporation */
2+
/* Copyright 2018-2021, Intel Corporation */
33

44
/**
55
* @file
@@ -213,7 +213,7 @@ struct range_snapshotting_iterator
213213
{
214214
assert(data <= ptr);
215215

216-
if (snapshot_size > 0)
216+
if (snapshot_size && ptr)
217217
snapshot_range(ptr);
218218
}
219219

include/libpmemobj++/container/vector.hpp

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: BSD-3-Clause
2-
/* Copyright 2018-2020, Intel Corporation */
2+
/* Copyright 2018-2021, Intel Corporation */
33

44
/**
55
* @file
@@ -644,7 +644,7 @@ vector<T>::assign(size_type count, const_reference value)
644644
add_data_to_tx(0, size_old);
645645

646646
std::fill_n(
647-
&_data[0],
647+
_data.get(),
648648
(std::min)(count,
649649
static_cast<size_type>(size_old)),
650650
value);
@@ -1578,7 +1578,7 @@ vector<T>::insert(const_iterator pos, size_type count, const value_type &value)
15781578
single_element_iterator<value_type>(&value, count));
15791579
});
15801580

1581-
return iterator(&_data[static_cast<difference_type>(idx)]);
1581+
return iterator(_data.get() + static_cast<difference_type>(idx));
15821582
}
15831583

15841584
/**
@@ -1821,7 +1821,7 @@ typename vector<T>::iterator
18211821
vector<T>::erase(const_iterator first, const_iterator last)
18221822
{
18231823
size_type idx = static_cast<size_type>(
1824-
std::distance(const_iterator(&_data[0]), first));
1824+
std::distance(const_iterator(_data.get()), first));
18251825
size_type count = static_cast<size_type>(std::distance(first, last));
18261826

18271827
if (count == 0)
@@ -2293,10 +2293,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
22932293
auto count = static_cast<size_type>(std::distance(first, last));
22942294

22952295
if (_capacity >= size() + count) {
2296-
pointer dest =
2297-
&_data[static_cast<difference_type>(size() + count)];
2298-
pointer begin = &_data[static_cast<difference_type>(idx)];
2299-
pointer end = &_data[static_cast<difference_type>(size())];
2296+
pointer dest = _data.get() +
2297+
static_cast<difference_type>(size() + count);
2298+
pointer begin = _data.get() + static_cast<difference_type>(idx);
2299+
pointer end =
2300+
_data.get() + static_cast<difference_type>(size());
23002301

23012302
add_data_to_tx(idx, size() - idx + count);
23022303

@@ -2314,9 +2315,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
23142315

23152316
auto old_data = _data;
23162317
auto old_size = _size;
2317-
pointer old_begin = &_data[0];
2318-
pointer old_mid = &_data[static_cast<difference_type>(idx)];
2319-
pointer old_end = &_data[static_cast<difference_type>(size())];
2318+
pointer old_begin = _data.get();
2319+
pointer old_mid =
2320+
_data.get() + static_cast<difference_type>(idx);
2321+
pointer old_end =
2322+
_data.get() + static_cast<difference_type>(size());
23202323

23212324
_data = nullptr;
23222325
_size = _capacity = 0;
@@ -2349,7 +2352,8 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
23492352
* Private helper function. Must be called during transaction. Allocates new
23502353
* memory for capacity_new number of elements and copies or moves old elements
23512354
* to new memory area. If the current size is greater than capacity_new, the
2352-
* container is reduced to its first capacity_new elements.
2355+
* container is reduced to its first capacity_new elements. If was never
2356+
* allocated behaves as an alloc call.
23532357
*
23542358
* param[in] capacity_new new capacity.
23552359
*
@@ -2368,6 +2372,13 @@ vector<T>::realloc(size_type capacity_new)
23682372
{
23692373
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
23702374

2375+
/*
2376+
* If _data == nullptr this object has never allocated any memory
2377+
* so we need to behave as alloc instead.
2378+
*/
2379+
if (_data == nullptr)
2380+
return alloc(capacity_new);
2381+
23712382
/*
23722383
* XXX: future optimization: we don't have to snapshot data
23732384
* which we will not overwrite
@@ -2376,7 +2387,7 @@ vector<T>::realloc(size_type capacity_new)
23762387

23772388
auto old_data = _data;
23782389
auto old_size = _size;
2379-
pointer old_begin = &_data[0];
2390+
pointer old_begin = _data.get();
23802391
pointer old_end = capacity_new < _size
23812392
? &_data[static_cast<difference_type>(capacity_new)]
23822393
: &_data[static_cast<difference_type>(size())];

tests/ptr/ptr.cpp

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: BSD-3-Clause
2-
/* Copyright 2015-2020, Intel Corporation */
2+
/* Copyright 2015-2021, Intel Corporation */
33

44
/*
55
* obj_cpp_ptr.c -- cpp bindings test
@@ -128,6 +128,38 @@ test_base_ptr_casting(nvobj::pool<root> &pop)
128128
UT_ASSERT(0);
129129
}
130130
}
131+
132+
/*
133+
* test_offset_with_alignment -- test offset calculation within a hierarchy of
134+
* objects with different alignments
135+
*/
136+
void
137+
test_offset_alignment(nvobj::pool<root> &pop)
138+
{
139+
struct A {
140+
char a;
141+
};
142+
143+
struct B {
144+
uint64_t b;
145+
};
146+
147+
struct C : public A, public B {
148+
uint64_t c;
149+
};
150+
151+
try {
152+
nvobj::transaction::run(pop, [] {
153+
auto cptr = nvobj::make_persistent<C>();
154+
nvobj::persistent_ptr<B> bptr = cptr;
155+
UT_ASSERT((bptr.raw().off - cptr.raw().off) ==
156+
alignof(B));
157+
nvobj::delete_persistent<C>(cptr);
158+
});
159+
} catch (...) {
160+
UT_ASSERT(0);
161+
}
162+
}
131163
}
132164

133165
static void
@@ -155,6 +187,7 @@ test(int argc, char *argv[])
155187
test_ptr_array(pop);
156188
test_offset(pop);
157189
test_base_ptr_casting(pop);
190+
test_offset_alignment(pop);
158191

159192
pop.close();
160193
}

travis.yml

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

0 commit comments

Comments
 (0)