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

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

CxxUtils: Fix a few cppcheck warnings.

See merge request atlas/athena!20921
parents 5f5336c4 38ce61fc
No related branches found
No related tags found
No related merge requests found
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
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: Array.icc,v 1.1 2009-03-20 20:44:22 ssnyder Exp $
......@@ -714,6 +714,7 @@ WritableArray<N>::WritableArray (Arrayrep& rep, unsigned int offs)
* match the length of the @c Arrayrep's shape.
*/
inline
// cppcheck-suppress uninitMemberVar ; false positive
WritableArray<0>::WritableArray (Arrayrep& rep)
: Array<0> (rep),
m_elt_nc (&rep.m_data[0])
......@@ -746,6 +747,7 @@ WritableArray<0>& WritableArray<0>::operator= (Arrayelt elt)
* instances returned from an indexing operation.
*/
inline
// cppcheck-suppress uninitMemberVarPrivate ; false positive
WritableArray<0>::WritableArray (Arrayrep& rep, unsigned int offs)
: Array<0> (rep, offs),
m_elt_nc (&rep.m_data[offs])
......
......@@ -25,7 +25,7 @@ size_t page_protect(T* addr, int prot) {
int rc=mprotect(pageAddr, lProtected, prot);
if (rc) printf("page_protect WARNING: mprotect heap failed for address %p\n", (void*)addr);
#ifdef DEBUG
else printf("page_protect DEBUG: set protection @%i for range @%lx - @%lx containing addr=%p\n",
else printf("page_protect DEBUG: set protection @%i for range @%lx - @%zx containing addr=%p\n",
prot,(long unsigned int)page_address(addr),(long unsigned int)addr+sizeof(T), (void*)addr);
#endif
return (rc == 0 ? lProtected : 0);
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
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: sincos.h,v 1.1 2008-11-24 04:34:07 ssnyder Exp $
......@@ -74,6 +74,7 @@ namespace CxxUtils {
*/
struct sincos
{
// cppcheck-suppress uninitMemberVar ; false positive
/// Calculate sine and cosine of x.
sincos (double x)
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
......
/*
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$
......@@ -34,6 +34,7 @@ union ieee754_double
struct {
unsigned int negative:1;
unsigned int exponent:11;
// cppcheck-suppress unusedStructMember
unsigned int quiet_nan:1;
/* Together these comprise the mantissa. */
unsigned int mantissa0:19;
......
......@@ -962,6 +962,7 @@ DebugAids::coredump (int sig, ...)
// to work any better, but try it anyway. Then make sure we
// die so that we won't return to the caller from the child.
abort ();
// cppcheck-suppress unreachableCode
_exit (255);
}
else if (corepid > 0) {
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/**
......@@ -82,9 +82,8 @@ namespace Athena { // wlav
// wlav modified from SealBase/src/SharedLibraryError.cpp
SharedLibraryError::SharedLibraryError (const std::string& context,
const std::string& cause)
: m_message ("Shared library operation")
{
m_message = "Shared library operation";
if (! context.empty ())
{
m_message += " ";
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/*
*/
......@@ -320,6 +320,9 @@ inline
uint64_t hightest (uint64_t x, uint64_t y)
{
// Relies on sign-extension of right-shift of a signed int.
// This is strictly speakign implementation-defined behavior.
// Since this code is anyway enabled only on x86_64, that's ok.
// cppcheck-suppress shiftTooManyBitsSigned
return y & (static_cast<int64_t>(x)>>63);
}
......
/*
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: Array_test.cxx,v 1.2 2009-04-08 21:12:45 ssnyder Exp $
......@@ -190,11 +190,13 @@ void test5()
++i11;
assert (i11[0][0] == 4);
// cppcheck-suppress postfixOperator
i11++;
assert (i11[0][0] == 7);
--i11;
assert (i11[0][0] == 4);
// cppcheck-suppress postfixOperator
i11--;
assert (i11[0][0] == 1);
......
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