mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 04:03:34 +08:00
Issue #100 remove auto_ptr and c++03 support.
Problem: auto_ptr is deprecated. Solution: use unique_ptr which is only available in c++11 and newer. Also fix how unit tests are run as part of the build to keep them from being deleted when they fail. Testing: Unit tests on linux run.
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
*/
|
||||
|
||||
#if __GNUC__
|
||||
// We need auto_ptr for compatibility reasons
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
|
||||
@@ -59,7 +57,7 @@ TEST(Map, Basic)
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * POOL_BLOCKS, uavcan::MemPoolBlockSize> pool;
|
||||
|
||||
typedef Map<std::string, std::string> MapType;
|
||||
std::auto_ptr<MapType> map(new MapType(pool));
|
||||
std::unique_ptr<MapType> map(new MapType(pool));
|
||||
|
||||
// Empty
|
||||
ASSERT_FALSE(map->access("hi"));
|
||||
@@ -198,7 +196,7 @@ TEST(Map, PrimitiveKey)
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * POOL_BLOCKS, uavcan::MemPoolBlockSize> pool;
|
||||
|
||||
typedef Map<short, short> MapType;
|
||||
std::auto_ptr<MapType> map(new MapType(pool));
|
||||
std::unique_ptr<MapType> map(new MapType(pool));
|
||||
|
||||
// Empty
|
||||
ASSERT_FALSE(map->access(1));
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
*/
|
||||
|
||||
#if __GNUC__
|
||||
// We need auto_ptr for compatibility reasons
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
|
||||
@@ -78,7 +76,7 @@ TEST(Multiset, Basic)
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * POOL_BLOCKS, uavcan::MemPoolBlockSize> pool;
|
||||
|
||||
typedef Multiset<std::string> MultisetType;
|
||||
std::auto_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
std::unique_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
|
||||
typedef SummationOperator<std::string> StringConcatenationOperator;
|
||||
|
||||
@@ -199,7 +197,7 @@ TEST(Multiset, PrimitiveKey)
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * POOL_BLOCKS, uavcan::MemPoolBlockSize> pool;
|
||||
|
||||
typedef Multiset<int> MultisetType;
|
||||
std::auto_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
std::unique_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
|
||||
// Empty
|
||||
mset->removeFirst(8);
|
||||
@@ -239,7 +237,7 @@ TEST(Multiset, NoncopyableWithCounter)
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * POOL_BLOCKS, uavcan::MemPoolBlockSize> pool;
|
||||
|
||||
typedef Multiset<NoncopyableWithCounter> MultisetType;
|
||||
std::auto_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
std::unique_ptr<MultisetType> mset(new MultisetType(pool));
|
||||
|
||||
ASSERT_EQ(0, NoncopyableWithCounter::num_objects);
|
||||
ASSERT_EQ(0, mset->emplace()->value);
|
||||
|
||||
Reference in New Issue
Block a user