From 9fb0118bd238742b5a7c88cbe2da2d56b03aeafb Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Tue, 3 Apr 2018 16:31:09 +0200 Subject: [PATCH] fixed warnings --- src/cltools/Driver.cpp | 2 +- src/tools/Communicator.cpp | 5 +++-- src/tools/Exception.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cltools/Driver.cpp b/src/cltools/Driver.cpp index d575b48ef..6ca916fb6 100644 --- a/src/cltools/Driver.cpp +++ b/src/cltools/Driver.cpp @@ -915,7 +915,7 @@ int Driver<real>::main(FILE* in,FILE*out,Communicator& pc) { p.cmd("GREX shareAllDeltaBias"); for(int i=0; i<n; i++) { string s; Tools::convert(i,s); - real a; s="GREX getDeltaBias "+s; p.cmd(s.c_str(),&a); + real a=NAN; s="GREX getDeltaBias "+s; p.cmd(s.c_str(),&a); if(grex_log) fprintf(grex_log," %f",a); } if(grex_log) fprintf(grex_log,"\n"); diff --git a/src/tools/Communicator.cpp b/src/tools/Communicator.cpp index 48acdd345..e933a6a50 100644 --- a/src/tools/Communicator.cpp +++ b/src/tools/Communicator.cpp @@ -224,12 +224,13 @@ MPI_Comm & Communicator::Get_comm() { } bool Communicator::initialized() { - int flag=false; #if defined(__PLUMED_HAS_MPI) + int flag=0; MPI_Initialized(&flag); -#endif if(flag) return true; else return false; +#endif + return false; } void Communicator::Request::wait(Status&s) { diff --git a/src/tools/Exception.h b/src/tools/Exception.h index fbf9e6ea3..38b1e18be 100644 --- a/src/tools/Exception.h +++ b/src/tools/Exception.h @@ -172,7 +172,7 @@ public: const char*file; const unsigned line; const char* pretty; - Location(const char*file,unsigned line,const char* pretty=nullptr): + explicit Location(const char*file,unsigned line,const char* pretty=nullptr): file(file), line(line), pretty(pretty) @@ -184,7 +184,7 @@ public: class Assertion { public: const char*assertion; - Assertion(const char*assertion=nullptr): + explicit Assertion(const char*assertion=nullptr): assertion(assertion) {} }; -- GitLab