Commit 3bd20b81 authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

'Adjust isSequence declaration for AthLinks-00-02-46.' (AthContainers-00-02-91)

	* Tagging AthContainers-00-02-91.
	* AthContainers/DataVector.h, AthContainers/DataList.h: Adjust
	isSequence declaration for AthLinks-00-02-46.

2016-08-25  scott snyder  <snyder@bnl.gov>

	* Tagging AthContainers-00-02-90.
	* Coverity 111205, 111211, 111213, 111236-111243, 111262, 111264,
	111293-111301, 111314.

2016-07-27  scott snyder  <snyder@bnl.gov>

	* Tagging AthContainers-00-02-89.
	* endreq -> endmsg.


Former-commit-id: 82525b02
parent 21ca8a36
......@@ -4,7 +4,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: AuxElementComplete.h 581165 2014-02-03 10:42:54Z krasznaa $
// $Id: AuxElementComplete.h 770199 2016-08-25 21:16:39Z ssnyder $
/**
* @file AthContainers/AuxElementComplete.h
* @author scott snyder <snyder@bnl.gov>
......@@ -70,6 +70,10 @@ public:
* A private store is created for this object.
*/
AuxElementComplete (const AuxElementComplete& other);
// Declare default assignment explicitly to prevent coverity warning.
AuxElementComplete& operator= (const AuxElementComplete& other) = default;
};
......
......@@ -4,7 +4,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: DataList.h 721712 2016-02-03 20:57:28Z ssnyder $
// $Id: DataList.h 772789 2016-09-12 15:55:30Z ssnyder $
/**
* @file AthContainers/DataList.h
......@@ -236,6 +236,7 @@
#include <iostream>
#include <algorithm> // for std::swap, find, find_if
#include <iterator>
#include <type_traits>
// Boost includes
#include <boost/static_assert.hpp>
......@@ -1265,7 +1266,7 @@ public:
typedef DataModel_detail::NoBase DVL_BASE;
/// Mark as a sequence, for DataLink / ElementLink.
typedef boost::true_type isSequence;
typedef std::true_type isSequence;
/// This is the type of the underlying @c std::list
/// (what @c stdcont returns).
......
......@@ -4,7 +4,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: DataVector.h 741471 2016-04-19 20:58:27Z ssnyder $
// $Id: DataVector.h 772789 2016-09-12 15:55:30Z ssnyder $
/**
* @file AthContainers/DataVector.h
......@@ -520,8 +520,8 @@
#include "AthContainers/tools/IsMostDerivedFlag.h"
#include "AthLinks/tools/selection_ns.h"
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <type_traits>
#include <vector>
#include <typeinfo>
#include <functional>
......@@ -529,9 +529,7 @@
#include <algorithm>
#include <stdexcept>
#include <iterator>
#if __cplusplus > 201100
#include <initializer_list>
#endif
......@@ -1931,7 +1929,7 @@ public:
typedef DataModel_detail::NoBase DVL_BASE;
/// Mark as a sequence, for DataLink / ElementLink.
typedef boost::true_type isSequence;
typedef std::true_type isSequence;
/// This is the type of the underlying @c std::vector
/// (what @c stdcont returns).
......
......@@ -18,8 +18,8 @@
*
* @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
*
* $Revision: 581165 $
* $Date: 2014-02-03 11:42:54 +0100 (Mon, 03 Feb 2014) $
* $Revision: 764634 $
* $Date: 2016-07-27 16:09:53 +0200 (Wed, 27 Jul 2016) $
*/
class UserDataStore {
......@@ -192,7 +192,7 @@ StatusCode UserDataStore::retrieve(const IAthenaBarCode& obj, const std::string&
StatusCode sc=this->retrieveAny(obj,label, aValue);
if (sc.isFailure()) return sc;
if (typeid(T) != aValue->type()) {
m_msg << MSG::ERROR << "Typeid mismatch while retrieving user data with label " << label << endreq;
m_msg << MSG::ERROR << "Typeid mismatch while retrieving user data with label " << label << endmsg;
return StatusCode::FAILURE;
}
const T* decoPtr=boost::any_cast<T>(aValue);
......
......@@ -55,7 +55,10 @@ public:
/**
* @brief Default constructor.
*/
DVLDataBucket() {}
DVLDataBucket() :
m_ti (nullptr),
m_clid (CLID_NULL)
{}
/**
......
......@@ -13,7 +13,7 @@ void UDSLabelHashTable::addLabel(const std::string& label, hash_t hash)
if (h != hash) {
MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
logstr << MSG::ERROR << "Hash mismatch for " << label
<< ": " << hash << "/" << h << endreq;
<< ": " << hash << "/" << h << endmsg;
}
}
......@@ -21,13 +21,13 @@ void UDSLabelHashTable::addLabel(const std::string& label, hash_t hash)
UDSLabelHashTable::hash_t UDSLabelHashTable::addLabel(const std::string& label) {
if (label.size()==0) {
MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
logstr << MSG::ERROR << "Zero-length string given as Label!" << endreq;
logstr << MSG::ERROR << "Zero-length string given as Label!" << endmsg;
return INVALID;
}
hash_t h=this->hash(label);
if (h==INVALID) {
MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
logstr << MSG::ERROR << "Label " << label << " yields an invalid hash. Please choose different name!" << endreq;
logstr << MSG::ERROR << "Label " << label << " yields an invalid hash. Please choose different name!" << endmsg;
return INVALID;
}
......@@ -40,7 +40,7 @@ UDSLabelHashTable::hash_t UDSLabelHashTable::addLabel(const std::string& label)
//Hash exists already
if (it->second!=label) { //Same hash but different label -> hash-collision!
MsgStream logstr(Athena::getMessageSvc(), "UDSLabelHashTable");
logstr << MSG::ERROR << "Hash collision between label " << label << " and label " << it->second << endreq;
logstr << MSG::ERROR << "Hash collision between label " << label << " and label " << it->second << endmsg;
return INVALID;
}
}
......
......@@ -52,13 +52,13 @@ StatusCode UserDataStore::recordAny(const IAthenaBarCode& obj, const std::string
const AthenaBarCode_t& barcode=obj.getAthenaBarCode();
if (barcode==IAthenaBarCode::UNDEFINEDBARCODE) {
m_msg << MSG::ERROR << "Attempt to record UserData for an object with undefined AthenaBarCode. Label=" << label << endreq;
m_msg << MSG::ERROR << "Attempt to record UserData for an object with undefined AthenaBarCode. Label=" << label << endmsg;
return StatusCode::FAILURE;
}
const index_t idx=m_labelTable.addLabel(label);
if (idx==UDSLabelHashTable::INVALID) {
m_msg << MSG::ERROR << "Failed to convert label '" << label << "' into a hash value" << endreq;
m_msg << MSG::ERROR << "Failed to convert label '" << label << "' into a hash value" << endmsg;
return StatusCode::FAILURE;
}
else {
......@@ -80,9 +80,9 @@ StatusCode UserDataStore::retrieveAny(const IAthenaBarCode& obj, const std::stri
const_iterator it=this->find(barcode,label);
if (it==m_notFoundIt) {
if (m_whyNotFound==BARCODE)
m_msg << MSG::ERROR << "No user data found for bar code " << barcode << endreq;
m_msg << MSG::ERROR << "No user data found for bar code " << barcode << endmsg;
if (m_whyNotFound==LABEL)
m_msg << MSG::ERROR << "No user data with label '" << label << "' found for this barcode" << endreq;
m_msg << MSG::ERROR << "No user data with label '" << label << "' found for this barcode" << endmsg;
return StatusCode::FAILURE;
}
else {
......
......@@ -27,6 +27,8 @@ public:
: SG::AuxElement(other),
x(other.x)
{}
Elt& operator= (const Elt&) = default;
int& ityp1()
{
......
......@@ -258,6 +258,8 @@ public:
makePrivateStore(other);
}
Elt& operator= (const Elt&) = default;
int& ityp1()
{
static Accessor<int> acc ("anInt");
......
......@@ -30,6 +30,7 @@ using namespace SGTest;
struct Payload
{
Payload (int x = 0) : m_x (x) {}
Payload& operator= (const Payload&) = default;
int m_x;
bool operator== (const Payload& other)
{ return m_x == other.m_x; }
......
......@@ -126,12 +126,11 @@ void test2()
{
std::cout << "test2\n";
SG::AuxTypeVector<int>* v1 = new SG::AuxTypeVector<int> (10, 20);
assert (!v1->setOption (SG::AuxDataOption ("opt", 1)));
SG::AuxTypeVector<int> v1 (10, 20);
assert (!v1.setOption (SG::AuxDataOption ("opt", 1)));
SG::AuxTypeVector<int, TestContainer>* v2 =
new SG::AuxTypeVector<int, TestContainer> (10, 20);
assert (v2->setOption (SG::AuxDataOption ("opt", 1)));
SG::AuxTypeVector<int, TestContainer> v2 (10, 20);
assert (v2.setOption (SG::AuxDataOption ("opt", 1)));
assert (TestContainer::lastopt.name() == "opt");
assert (TestContainer::lastopt.intVal() == 1);
}
......@@ -141,38 +140,38 @@ void test2()
void test3()
{
std::cout << "test3\n";
SG::AuxTypeVector<int>* v1 = new SG::AuxTypeVector<int> (0, 0);
v1->vec().push_back(1);
v1->vec().push_back(2);
SG::AuxTypeVector<int> v1 (0, 0);
v1.vec().push_back(1);
v1.vec().push_back(2);
assert (v1->objType() == &typeid(std::vector<int>));
assert (v1.objType() == &typeid(std::vector<int>));
void* ptr = v1->toPtr();
void* ptr = v1.toPtr();
int* iptr = reinterpret_cast<int*>(ptr);
assert (v1->size() == 2);
assert (v1.size() == 2);
assert (iptr[0] == 1);
assert (iptr[1] == 2);
SG::IAuxTypeVector* v2 = v1->toPacked();
SG::IAuxTypeVector* v2 = v1.toPacked();
assert (v2 != 0);
assert (ptr == v2->toPtr());
assert (v2->size() == 2);
assert (iptr[0] == 1);
assert (iptr[1] == 2);
assert (v1->size() == 0);
assert (v1->toPtr() == 0);
assert (v1.size() == 0);
assert (v1.toPtr() == 0);
assert (v2->objType() == &typeid(SG::PackedContainer<int>));
SG::PackedContainer<int>* pptr =
reinterpret_cast<SG::PackedContainer<int>*> (v2->toVector());
assert (typeid(*pptr) == typeid(SG::PackedContainer<int>));
SG::AuxTypeVector<std::string>* v3 = new SG::AuxTypeVector<std::string> (0, 0);
v3->vec().push_back("1");
v3->vec().push_back("2");
SG::AuxTypeVector<std::string> v3 (0, 0);
v3.vec().push_back("1");
v3.vec().push_back("2");
assert (v3->toPacked() == 0);
assert (v3->size() == 2);
assert (v3.toPacked() == 0);
assert (v3.size() == 2);
}
......
......@@ -693,8 +693,8 @@ void test_copy_base_aux()
SG::auxid_t ityp1 = SG::AuxTypeRegistry::instance().getAuxID<int> ("anInt1");
C* pc = new C;
b1.setIndexTest (pc, 0);
C pc;
b1.setIndexTest (&pc, 0);
b1.getData<int> (ityp1, 0) = 10;
SG::AuxVectorBase_test b2;
......
......@@ -83,17 +83,17 @@ void tester()
typedef typename T::DD DD;
typedef typename DataModel_detail::DVLCast<T> Cast;
D* d = new D (1);
DD* dd = new DD (2);
B* b = d;
assert (Cast::cast (b) == d);
const B* cb = d;
assert (Cast::cast (cb) == d);
b = dd;
D* dd2 = dd;
D d(1);
DD dd(2);
B* b = &d;
assert (Cast::cast (b) == &d);
const B* cb = &d;
assert (Cast::cast (cb) == &d);
b = &dd;
D* dd2 = &dd;
assert (Cast::cast (b) == dd2);
cb = dd;
cb = &dd;
assert (Cast::cast (cb) == dd2);
}
......
......@@ -155,6 +155,7 @@ class myvec2
public:
myvec2 (SG::OwnershipPolicy pol = SG::VIEW_ELEMENTS) : myvec (pol) {}
myvec2 (const myvec2&) : myvec (SG::VIEW_ELEMENTS), SG::AuxVectorBase() {}
myvec2& operator= (const myvec2&) = delete;
virtual size_t capacity_v() const { return 0; }
virtual size_t size_v() const { return 0; }
};
......@@ -234,7 +235,8 @@ CONT* test_DVLInfo1 ()
int ii = 0;
while (const void* p = iit->next()) {
const int* pp = reinterpret_cast<const int*> (p);
assert (*pp == ii++);
assert (*pp == ii);
++ii;
}
return cont;
......@@ -291,14 +293,14 @@ void test_dvl_convert1()
{
static DataModel_detail::DVLInfo<CONTB> info;
CONTD* contd = new CONTD (SG::VIEW_ELEMENTS);
CONTD contd (SG::VIEW_ELEMENTS);
for (int i=0; i < 10; i++)
contd->push_back (new D(i));
contd.push_back (new D(i));
DataModel_detail::DVLInfoBase* info2;
void* newp = DataModel_detail::dvl_convert (*contd, typeid (CONTI), info2);
void* newp = DataModel_detail::dvl_convert (contd, typeid (CONTI), info2);
assert (newp == 0);
newp = DataModel_detail::dvl_convert (*contd, typeid (CONTB), info2);
newp = DataModel_detail::dvl_convert (contd, typeid (CONTB), info2);
assert (info2->tinfo() == info.tinfo());
CONTB* contb = reinterpret_cast<CONTB*> (newp);
assert (contb->size() == 10);
......@@ -308,7 +310,7 @@ void test_dvl_convert1()
++it;
}
newp = DataModel_detail::dvl_convert (*contd,
newp = DataModel_detail::dvl_convert (contd,
ClassID_traits<CONTB>::ID(), info2);
assert (info2->tinfo() == info.tinfo());
contb = reinterpret_cast<CONTB*> (newp);
......@@ -319,10 +321,10 @@ void test_dvl_convert1()
++it;
}
CONTD* contd2 = new CONTD (SG::VIEW_ELEMENTS);
CONTD contd2 (SG::VIEW_ELEMENTS);
for (int i=9; i >= 0; i--)
contd->push_back (new D(i));
DataModel_detail::dvl_update (*contd2, newp, info2);
contd.push_back (new D(i));
DataModel_detail::dvl_update (contd2, newp, info2);
it = contb->begin();
for (int i=9; i >= 0; i--) {
assert ((*it)->bb = i+10);
......
......@@ -104,6 +104,7 @@ struct DerivedFluff : public AbsFluff {
AbsFluff(),
m_int(rhs.m_int), m_float(-379.456f),
m_string("this is the Fluff struct") { }
DerivedFluff& operator= (const DerivedFluff&) = delete;
virtual void foo() { /* std::cout << "foo called" << std::endl; */ }
virtual void cfoo() const { /* std::cout << "foo called" << std::endl; */ }
......@@ -3423,6 +3424,7 @@ void test_copyconvert()
MM* mm = *it;
assert (mm->mm == i + 100);
P* pp = dynamic_cast<P*> (mm);
if (!pp) std::abort();
assert (pp->x == i);
++it;
}
......@@ -3442,7 +3444,8 @@ void test_iterate()
int ii = 0;
while (const void* p = iterator->next()) {
const P* pp = reinterpret_cast<const P*> (p);
assert (pp->x == ii++);
assert (pp->x == ii);
++ii;
}
delete iterator;
......
......@@ -66,6 +66,7 @@ struct DerivedFluff : public AbsFluff {
AbsFluff(),
m_int(rhs.m_int), m_float(-379.456f),
m_string("this is the Fluff struct") { }
DerivedFluff& operator= (const DerivedFluff&) = delete;
virtual void foo() { /* cout << "foo called" << std::endl; */ }
virtual void cfoo() const { /* cout << "foo called" << std::endl; */ }
......@@ -560,7 +561,8 @@ void test_iterate()
int ii = 0;
while (const void* p = iterator->next()) {
const P* pp = reinterpret_cast<const P*> (p);
myassert (pp->x == ii++);
myassert (pp->x == ii);
++ii;
}
delete iterator;
......
......@@ -777,7 +777,7 @@ void test2_insertion_ctor2()
test2_insertion_ctor1<DV>();
typedef typename DV::base_value_type T;
bool auxdata = typename SG::AuxStore_traits<T>::flag();
const bool auxdata = typename SG::AuxStore_traits<T>::flag();
clear_dtor_log();
{
std::vector<typename DV::value_type> tt;
......
......@@ -90,6 +90,7 @@ struct Payload
{
Payload(int i) : m_i(i) { std::cout << "ctor " << i << "\n"; }
~Payload() { std::cout << "dtor " << m_i << "\n"; }
Payload& operator= (const Payload&) = default;
int m_i;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment