Skip to content
Snippets Groups Projects
Commit 0de9d15d authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'cppcheck.AthenaKernel-20190206' into 'master'

AthenaKernel: Fix cppcheck warnings.

See merge request atlas/athena!20922
parents 81a6864d 9e00917b
No related branches found
No related tags found
No related merge requests found
///////////////////////// -*- C++ -*- ///////////////////////////// ///////////////////////// -*- C++ -*- /////////////////////////////
/* /*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/ */
#include "AthenaKernel/IRegisterTransient.h" #include "AthenaKernel/IRegisterTransient.h"
...@@ -65,6 +65,7 @@ SG::DataBucket<T>::DataBucket(T* data) ...@@ -65,6 +65,7 @@ SG::DataBucket<T>::DataBucket(T* data)
template <typename T> template <typename T>
template <typename U> template <typename U>
// cppcheck-suppress uninitMemberVar ; false positive
SG::DataBucket<T>::DataBucket(std::unique_ptr<U> data) SG::DataBucket<T>::DataBucket(std::unique_ptr<U> data)
// Rely on our caller to retain constness. // Rely on our caller to retain constness.
: DataBucket (const_cast<typename std::remove_const<U>::type*> (data.release())) : DataBucket (const_cast<typename std::remove_const<U>::type*> (data.release()))
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ATHENAKERNEL_POSIXTIMEKEEPER_H #ifndef ATHENAKERNEL_POSIXTIMEKEEPER_H
...@@ -34,7 +34,8 @@ public: ...@@ -34,7 +34,8 @@ public:
/// TimeKeeper Implementation /// TimeKeeper Implementation
//@{ //@{
virtual time_t allocTime() const = 0; ///< allocated CPU time for job virtual time_t allocTime() const = 0; ///< allocated CPU time for job
virtual void updateTime(); // cppcheck-suppress virtualCallInConstructor
virtual void updateTime();
virtual const std::string& unitLabel() const; virtual const std::string& unitLabel() const;
//@} //@}
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/ */
// $Id: errorcheck.cxx,v 1.5 2009-04-09 15:11:17 ssnyder Exp $ // $Id: errorcheck.cxx,v 1.5 2009-04-09 15:11:17 ssnyder Exp $
...@@ -104,8 +104,8 @@ std::string munge_punct (const std::string& str_in) ...@@ -104,8 +104,8 @@ std::string munge_punct (const std::string& str_in)
std::string do_replace (std::string s, std::string do_replace (std::string s,
const std::string pat, const std::string& pat,
const std::string rep) const std::string& rep)
{ {
std::string::size_type ipos = 0; std::string::size_type ipos = 0;
while ((ipos = s.find (pat, ipos)) != std::string::npos) while ((ipos = s.find (pat, ipos)) != std::string::npos)
...@@ -124,7 +124,7 @@ std::string munge_names (const std::string& str_in) ...@@ -124,7 +124,7 @@ std::string munge_names (const std::string& str_in)
s = do_replace (s, "void* ", "void*"); s = do_replace (s, "void* ", "void*");
s = do_replace (s, "CLID", "unsigned int"); s = do_replace (s, "CLID", "unsigned int");
if (s.find ("virtual ") == 0) if (s.compare (0, 8, "virtual ") == 0)
s.erase (0, 8); s.erase (0, 8);
return s; return s;
} }
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/ */
// $Id$ // $Id$
...@@ -128,6 +128,8 @@ void test1() ...@@ -128,6 +128,8 @@ void test1()
optr = &rcuo; optr = &rcuo;
assert (svc.m_removed == nullptr); assert (svc.m_removed == nullptr);
} }
// cppcheck-suppress invalidLifetime
// cppcheck-suppress deadpointer
assert (svc.m_removed == optr); assert (svc.m_removed == optr);
} }
Payload::getlog(); Payload::getlog();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment