Commit 62e40b34 authored by gsell's avatar gsell
Browse files

Merge branch '478-fix-warnings-with-gcc-9-2-and-wextra-and-some-cleanup' into 'master'

Resolve "fix warnings with GCC 9.2 and -Wextra and some cleanup"

Closes #478

See merge request !292
parents 269b7b0d 855f4936
......@@ -46,7 +46,7 @@ add_definitions (-DNOCTAssert)
add_compile_options (-Wall)
add_compile_options (-Wunused)
add_compile_options (-Wextra)
#add_compile_options (-Werror)
add_compile_options (-Werror)
add_compile_options (-funroll-loops)
add_compile_options (-fstrict-aliasing)
......@@ -67,9 +67,7 @@ if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" )
endif ()
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options (-Wsign-compare)
add_compile_options (-Wunused-variable)
add_compile_options (-Warray-bounds)
add_compile_options (-Warray-bounds-pointer-arithmetic)
# Increase template depth for boost
add_compile_options (-ftemplate-depth=1024)
# get rid of linking warning with boost. Looks like that boost
......
......@@ -256,6 +256,9 @@ FFTPACK<T>::callFFT(unsigned transformDim, int direction, T* data) {
// check transform dimension and direction arguments
PAssert_LT(transformDim, numTransformDims_m);
// avoid unused variable warning if we compile with Release
// :FIXME: remove direction
(void)direction;
PAssert_EQ(std::abs(direction), 1);
// branch on transform type for this dimension
......
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit www.amas.web.psi for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
......@@ -113,7 +94,7 @@ TryCompressLHS(LField<T,Dim>& lf, A& rhs, Op op, const NDIndex<Dim>& domain)
// is for assignment.
if (c1 && c3 && c4)
{
T tmpval;
T tmpval{};
PETE_apply(op, tmpval, for_each(rhs, EvalFunctor_0()));
if (*lf.begin() == tmpval)
{
......@@ -676,9 +657,10 @@ assign(const BareField<T1,Dim>& ca, RHS b, OP op, ExprTag<true>)
//INCIPPLSTAT(incBFEqualsExpression);
}
/***************************************************************************
* $RCSfile: Assign.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
* IPPL_VERSION_ID: $Id: Assign.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -2795,8 +2795,6 @@ void ExtrapolateFace<T,D,M,C>::apply( Field<T,D,M,C>& A )
}
//#pragma GCC push_options
//#pragma GCC optimize "no-tree-vrp"
template<class T, unsigned D, class M, class C>
inline void
ExtrapolateFaceBCApply2(const NDIndex<D> &dest, const NDIndex<D> &src,
......@@ -2862,7 +2860,6 @@ ExtrapolateFaceBCApply2(const NDIndex<D> &dest, const NDIndex<D> &src,
(ef.getOffset(),ef.getSlope(),ef.getComponent())).apply();
}
}
//#pragma GCC pop_options
//-----------------------------------------------------------------------------
......
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
......@@ -9,18 +8,6 @@
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit www.amas.web.psi for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// include files
......@@ -54,12 +41,10 @@ public:
for (d=3; d<Dim; ++d)
{
Lhs.step(d);
// #pragma inline here
for_each(Rhs,StepFunctor(d),PETE_NullCombiner());
if ( ! Lhs.done(d) )
break;
Lhs.rewind(d);
// #pragma inline here
for_each(Rhs,RewindFunctor(d),PETE_NullCombiner());
}
} while (d<Dim);
......@@ -128,15 +113,14 @@ public:
template<unsigned Dim, class LHS, class RHS, class OP>
void BrickExpression<Dim,LHS,RHS,OP>::apply()
{
// #pragma inline here
BrickExpLoop<LHS,RHS,OP,Dim>::apply(Lhs,Rhs,Op);
}
/***************************************************************************
* $RCSfile: BrickExpression.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
* IPPL_VERSION_ID: $Id: BrickExpression.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
......@@ -67,6 +63,7 @@ public:
Field(Layout_t &,const GuardCellSizes<Dim>&,const BConds<T,Dim,M,C>&);
Field(Layout_t &,const BConds<T,Dim,M,C>&,const GuardCellSizes<Dim>&);
Field(FieldSpec<T,Dim,M,C>&);
constexpr Field(Field<T,Dim,M,C>&) = default;
// Constructors including a Mesh object as argument:
Field(Mesh_t&, Layout_t &);
......@@ -187,10 +184,12 @@ private:
#include "Field/Field.hpp"
#endif // FIELD_H
#endif
/***************************************************************************
* $RCSfile: Field.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
* IPPL_VERSION_ID: $Id: Field.h,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -31,7 +31,7 @@ public:
GuardCellSizes(unsigned *s);
GuardCellSizes(unsigned l, unsigned r);
GuardCellSizes(unsigned *l, unsigned *r);
constexpr GuardCellSizes<Dim>(const GuardCellSizes<Dim>&) = default;
GuardCellSizes<Dim>& operator=(const GuardCellSizes<Dim>& gc)
{
for (unsigned d=0; d<Dim; ++d) {
......
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
......@@ -207,6 +203,7 @@ public:
enum { Dim_u = Dim };
typedef IndexedBareFieldIterator<T,Dim> iterator;
constexpr IndexedBareField (const IndexedBareField<T, Dim, Brackets>&) = default;
IndexedBareField<T,Dim,Brackets+1> operator[](const Index& idx)
{
CTAssert(Brackets<Dim);
......@@ -340,8 +337,10 @@ std::ostream& operator<<(std::ostream& out, const IndexedBareField<T,Dim,Bracket
#endif // INDEXED_BARE_FIELD_H
/***************************************************************************
* $RCSfile: IndexedBareField.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
* IPPL_VERSION_ID: $Id: IndexedBareField.h,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
set (_SRCS
FieldLayoutUser.cpp
VRB.cpp
)
......
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit www.amas.web.psi for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// include files
#include "FieldLayout/FieldLayoutUser.h"
////////////////////////////////////////////////////////////////////////
// constructor - the base class selects a unique ID value
FieldLayoutUser::FieldLayoutUser() { }
////////////////////////////////////////////////////////////////////////
// destructor, nothing to do here
FieldLayoutUser::~FieldLayoutUser() { }
/***************************************************************************
* $RCSfile: FieldLayoutUser.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
* IPPL_VERSION_ID: $Id: FieldLayoutUser.cpp,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
***************************************************************************/
......@@ -3,9 +3,6 @@
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
#ifndef FIELD_LAYOUT_USER_H
......@@ -31,10 +28,10 @@ class FieldLayoutUser : public User {
public:
// constructor - the base class selects a unique ID value
FieldLayoutUser();
FieldLayoutUser() {};
// destructor, nothing to do here
virtual ~FieldLayoutUser();
virtual ~FieldLayoutUser() {};
//
// virtual functions for FieldLayoutUser's
......@@ -46,8 +43,10 @@ public:
#endif // FIELD_LAYOUT_USER_H
/***************************************************************************
* $RCSfile: FieldLayoutUser.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
* IPPL_VERSION_ID: $Id: FieldLayoutUser.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
#ifndef TAG_MAKER_H
......@@ -107,3 +103,11 @@ private:
};
#endif // TAG_MAKER_H
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
......@@ -13,17 +12,6 @@
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// include files
#include "Particle/IpplParticleBase.h"
#include "Particle/ParticleLayout.h"
#include "Particle/ParticleAttrib.h"
......@@ -33,6 +21,7 @@
#include "Utility/PAssert.h"
#include "Utility/IpplInfo.h"
#include "Utility/IpplStats.h"
#include "Utility/IpplException.h"
#include <algorithm>
/////////////////////////////////////////////////////////////////////
......@@ -148,7 +137,11 @@ void IpplParticleBase<PLayout>::resetID(void) {
Message* msg2 = new Message;
msg2->put(lp[ip]);
bool success = Ippl::Comm->send(msg2,ip,tag2);
PAssert(success);
if (success == false) {
throw IpplException (
"IpplParticleBase<PLayout>::resetID()",
"sending initial ID values failed.");
}
}
// we are done
return;
......@@ -159,7 +152,11 @@ void IpplParticleBase<PLayout>::resetID(void) {
Message* msg1 = new Message;
msg1->put(localNum);
bool success = Ippl::Comm->send(msg1,master,tag1);
PAssert(success);
if (success == false) {
throw IpplException (
"IpplParticleBase<PLayout>::resetID()",
"sending initial ID values failed.");
}
// now receive back our initial ID number
size_t initialID = 0;
int tag2 = Ippl::Comm->next_tag(P_RESET_ID_TAG,P_LAYOUT_CYCLE);
......@@ -776,9 +773,10 @@ void IpplParticleBase<PLayout>::printDebug(Inform& o) {
Layout->printDebug(o);
}
/***************************************************************************
* $RCSfile: IpplParticleBase.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
* IPPL_VERSION_ID: $Id: IpplParticleBase.cpp,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -715,6 +715,9 @@ public:
T const * operator->() const { return getP(); }
ParticleAttribConstIterator<T>& operator=(const ParticleAttribConstIterator<T>&) = default;
ParticleAttribConstIterator<T>& operator++(void) {
++curr;
return *this;
......
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
......@@ -71,6 +67,8 @@ public:
//# public enumerations
enum { Dim_u = Dim };
constexpr SubBareField(const SubBareField<T, Dim, S>&) = default;
// Return the beginning and end iterators for this class.
iterator begin() const;
iterator end() const;
......@@ -237,10 +235,12 @@ std::ostream& operator<<(std::ostream& o, const SubBareField<T,Dim,S>& s) {
#include "SubField/SubBareField.hpp"
#endif // SUB_BARE_FIELD_H
#endif
/***************************************************************************
* $RCSfile: SubBareField.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: SubBareField.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
......@@ -73,8 +69,10 @@ SUB_ASSIGNMENT_OPERATORS(maxeq,OpMaxAssign)
#endif // SUB_FIELD_ASSIGN_H
/***************************************************************************
* $RCSfile: SubFieldAssign.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: SubFieldAssign.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
***************************************************************************/
#ifndef PASSERT_H
#define PASSERT_H
......@@ -57,17 +53,11 @@ public:
assertion( const char *cond, const char *file, int line );
assertion( const char *m );
assertion( const assertion& a );
~assertion() throw() { delete[] msg; }
~assertion() throw() { delete[] msg; }
assertion& operator=( const assertion& a );
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
const char* what() { return msg; }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
using std::runtime_error::what;
virtual const char* what() { return msg; };
};
//---------------------------------------------------------------------------//
......@@ -143,8 +133,10 @@ void insist( const char *cond, const char *msg, const char *file, int line );
#endif // PASSERT_H
/***************************************************************************
* $RCSfile: PAssert.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: PAssert.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// -*- C++ -*-
/**************************************************************************************************************************************
/******************************************************************************
*
* The IPPL Framework
*
......@@ -14,7 +13,7 @@
* epsilon is the softening parameter, printSteps=10 prints every tenth step
*
*
*************************************************************************************************************************************/
******************************************************************************/
#include "Ippl.h"
#include <cassert>
#include <string>
......@@ -473,10 +472,6 @@ class ChargedParticles : public IpplParticleBase<PL> {
H5f_m = H5OpenFile(fn.c_str(), H5_O_WRONLY, props);
}
inline double getEFDMag(int x, int y, int z) {
return eg_m[x][y][z].get();
}
const Vector_t get_hr() { return hr_m; }
......@@ -783,4 +778,12 @@ int main(int argc, char *argv[]){
delete mesh;
return 0;
}
\ No newline at end of file
}
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -23,7 +23,6 @@ int main(int argc, char *argv[]) {
const unsigned D=3U;
double hightail;
unsigned int d;
int tag = Ippl::Comm->next_tag(tag);
unsigned ngrid[D]; // grid sizes sizes
unsigned int iters = 100;
......
#ifndef OPAL_Expressions_HH
#define OPAL_Expressions_HH 1
// ------------------------------------------------------------------------
// $RCSfile: Expressions.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Namespace Expressions
// This namespace contains the representations for all OPAL expressions
......@@ -43,12 +33,16 @@
// Declared functions:
// A collection of functions implementing a recursive descent parser.
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:34 $
// $Author: Andreas Adelmann $
// Copyright (c) 2008-2020
// Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved.
//
// OPAL is licensed under GNU GPL version 3.
//
// ------------------------------------------------------------------------
#ifndef OPAL_Expressions_HH