Skip to content

Commit

Permalink
Merge pull request #2755 from vicentebolea/enable-wall-bydefault
Browse files Browse the repository at this point in the history
CI:  Enforce -Werror & -Wall in cpp sources
  • Loading branch information
Chuck Atkins authored Aug 3, 2021
2 parents 231dec1 + c25d68c commit 52cf30a
Show file tree
Hide file tree
Showing 91 changed files with 450 additions and 182 deletions.
1 change: 0 additions & 1 deletion bindings/CXX11/adios2/cxx11/Engine.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ typename Variable<T>::Span Engine::Put(Variable<T> variable,
template <class T>
typename Variable<T>::Span Engine::Put(Variable<T> variable)
{
using IOType = typename TypeInfo<T>::IOType;
adios2::helper::CheckForNullptr(m_Engine,
"for Engine in call to Engine::Array");

Expand Down
4 changes: 2 additions & 2 deletions bindings/Python/py11File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pybind11::array File::Read(const std::string &name, const Dims &start,
m_Stream->Read<std::string>(name, blockID).front();
pybind11::array_t<char> pyArray(Dims{value.size()});
std::copy(value.begin(), value.end(), pyArray.mutable_data());
return pyArray;
return std::move(pyArray);
}

return Read(name, start, count, 0, 0, blockID);
Expand Down Expand Up @@ -270,7 +270,7 @@ pybind11::array File::ReadAttribute(const std::string &name,
pybind11::array_t<T> pyArray(attribute->m_Elements); \
m_Stream->ReadAttribute<T>(name, pyArray.mutable_data(), variableName, \
separator); \
return pyArray; \
return std::move(pyArray); \
}
ADIOS2_FOREACH_NUMPY_ATTRIBUTE_TYPE_1ARG(declare_type)
#undef declare_type
Expand Down
2 changes: 1 addition & 1 deletion bindings/Python/py11File.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pybind11::array File::DoRead(const std::string &name, const Dims &_start,
}
m_Stream->m_Engine->Get(variable, pyArray.mutable_data(), Mode::Sync);

return pyArray;
return std::move(pyArray);
}

} // end namespace py11
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindPythonModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ if(PythonModule_${module_NAME}_FOUND AND
add_library(${module_NAME} INTERFACE)
add_library(Python::${module_NAME} ALIAS ${module_NAME})
foreach(inc_var IN LISTS include_vars)
target_include_directories(${module_NAME} INTERFACE ${${inc_var}})
target_include_directories(${module_NAME} SYSTEM INTERFACE ${${inc_var}})
endforeach()
foreach(lib_var IN LISTS library_vars)
target_link_libraries(${module_NAME} INTERFACE ${${lib_var}})
Expand Down
2 changes: 2 additions & 0 deletions examples/basics/values/values_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ int main(int argc, char *argv[])
*/
// 1. Global constant, same value across processes, constant over time
adios2::Variable<int> varNproc = io.DefineVariable<int>("Nproc");
(void)varNproc; // For the sake of the example we create an unused
// variable

// 2. Global value, same value across processes, varying value over time
adios2::Variable<int> varStep = io.DefineVariable<int>("Step");
Expand Down
1 change: 1 addition & 0 deletions examples/heatTransfer/read_fileonly/heatRead_adios2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ int main(int argc, char *argv[])

adios2::Variable<unsigned int> vgndx =
bpReaderIO.InquireVariable<unsigned int>("gndx");
(void)vgndx;

// gndx = vgndx.GetData()[0];

Expand Down
2 changes: 1 addition & 1 deletion examples/hello/bpReader/helloBPReader_nompi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char *argv[])
bpIO.AvailableVariables(true);

std::cout << "List of variables:";
for (const auto variablePair : variables)
for (const auto &variablePair : variables)
{
std::cout << " " << variablePair.first;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/hello/bpWriter/helloBPSZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ int main(int argc, char *argv[])
adios2::Attribute<double> attribute =
bpIO.DefineAttribute<double>("SZ_accuracy", accuracy);

// To avoid compiling warnings
(void)attribute;

/** Engine derived class, spawned to start IO operations */
adios2::Engine bpFileWriter =
bpIO.Open("SZexample.bp", adios2::Mode::Write);
Expand Down
2 changes: 2 additions & 0 deletions examples/hello/bpWriter/helloBPSubStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ int main(int argc, char *argv[])

adios2::Attribute<int> attribute =
bpIO.DefineAttribute<int>("attrINT", -1);
(void)attribute; // For the sake of the example we create an unused
// variable

/** Engine derived class, spawned to start IO operations */
adios2::Engine bpFileWriter =
Expand Down
2 changes: 2 additions & 0 deletions examples/hello/bpWriter/helloBPWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ int main(int argc, char *argv[])

adios2::Variable<std::string> bpString =
bpIO.DefineVariable<std::string>("bpString");
(void)bpString; // For the sake of the example we create an unused
// variable

std::string filename = "myVector_cpp.bp";
/** Engine derived class, spawned to start IO operations */
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char *argv[])
const std::map<std::string, adios2::Params> variables =
h5IO.AvailableVariables();

for (const auto variablePair : variables)
for (const auto &variablePair : variables)
{
std::cout << "Name: " << variablePair.first;
std::cout << std::endl;
Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/cmake/ci-ascent-gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ env_module(load zeromq)
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=OFF
Expand All @@ -30,6 +27,8 @@ ADIOS2_USE_SST:BOOL=ON
ADIOS2_USE_SZ:BOOL=OFF
ADIOS2_USE_ZeroMQ:STRING=ON
ADIOS2_USE_ZFP:BOOL=OFF
CMAKE_Fortran_FLAGS:STRING=-Werror -Wno-error=builtin-declaration-mismatch
")

set(NCPUS 4)
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/cmake/ci-debian-sid-openmpi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(ENV{CXXFLAGS} "-Wno-deprecated -Wno-deprecated-declarations")
set(dashboard_cache "
ADIOS2_USE_EXTERNAL_DEPENDENCIES:BOOL=ON
ADIOS2_USE_EXTERNAL_EVPATH:BOOL=OFF
ADIOS2_USE_EXTERNAL_NLOHMANN_JSON:BOOL=OFF
ADIOS2_USE_BZip2:BOOL=ON
ADIOS2_USE_Blosc:BOOL=ON
ADIOS2_USE_Fortran:BOOL=ON
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/cmake/ci-debian-sid.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(ENV{CXXFLAGS} "-Wno-deprecated -Wno-deprecated-declarations")
set(dashboard_cache "
ADIOS2_USE_EXTERNAL_DEPENDENCIES:BOOL=ON
ADIOS2_USE_EXTERNAL_EVPATH:BOOL=OFF
ADIOS2_USE_EXTERNAL_NLOHMANN_JSON:BOOL=OFF
ADIOS2_USE_BZip2:BOOL=ON
ADIOS2_USE_Blosc:BOOL=ON
ADIOS2_USE_Fortran:BOOL=ON
Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/cmake/ci-el7-gnu8-ohpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ env_module(load hdf5)
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand All @@ -25,6 +22,10 @@ ADIOS2_USE_Python:BOOL=ON
ADIOS2_USE_SZ:BOOL=ON
ADIOS2_USE_ZeroMQ:STRING=ON
ADIOS2_USE_ZFP:BOOL=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
CMAKE_Fortran_FLAGS:STRING=-Werror -Wno-error=builtin-declaration-mismatch
")

set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/cmake/ci-el7-gnu8-openmpi-ohpc-static.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ env_module(load py3-mpi4py)
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
BUILD_SHARED_LIBS:BOOL=OFF
Expand All @@ -36,6 +33,10 @@ ADIOS2_USE_SZ:BOOL=OFF
ADIOS2_USE_ZeroMQ:STRING=OFF
ADIOS2_USE_ZFP:BOOL=OFF
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
CMAKE_Fortran_FLAGS:STRING=-Werror -Wno-error=builtin-declaration-mismatch
MPIEXEC_EXTRA_FLAGS:STRING=--allow-run-as-root --oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=${N2CPUS}
")
Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/cmake/ci-el7-gnu8-openmpi-ohpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ env_module(load py3-mpi4py)
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand All @@ -32,6 +29,10 @@ ADIOS2_USE_SZ:BOOL=ON
ADIOS2_USE_ZeroMQ:STRING=ON
ADIOS2_USE_ZFP:BOOL=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
CMAKE_Fortran_FLAGS:STRING=-Werror -Wno-error=builtin-declaration-mismatch
MPIEXEC_EXTRA_FLAGS:STRING=--allow-run-as-root --oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=${N2CPUS}
")
Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/cmake/ci-el7-intel-ohpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ env_module(load hdf5)
set(ENV{CC} icc)
set(ENV{CXX} icpc)
set(ENV{FC} ifort)
set(ENV{CFLAGS} -Werror)
set(ENV{CXXFLAGS} -Werror)
set(ENV{FFLAGS} "-warn errors")

set(dashboard_cache "
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
ADIOS2_USE_BZip2:BOOL=ON
ADIOS2_USE_Blosc:BOOL=ON
ADIOS2_USE_DataMan:BOOL=ON
Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/cmake/ci-el7-intel-openmpi-ohpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ env_module(load py3-mpi4py)
set(ENV{CC} icc)
set(ENV{CXX} icpc)
set(ENV{FC} ifort)
set(ENV{CFLAGS} -Werror)
set(ENV{CXXFLAGS} -Werror)
set(ENV{FFLAGS} "-warn errors")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand All @@ -32,6 +29,10 @@ ADIOS2_USE_SZ:BOOL=ON
ADIOS2_USE_ZeroMQ:STRING=ON
ADIOS2_USE_ZFP:STRING=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
CMAKE_Fortran_FLAGS:STRING=-warn errors
MPIEXEC_EXTRA_FLAGS:STRING=--allow-run-as-root --oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=${N2CPUS}
")
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/cmake/ci-el7-spack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ADIOS2_USE_EXTERNAL_DEPENDENCIES:BOOL=ON
ADIOS2_USE_EXTERNAL_GTEST:BOOL=OFF
ADIOS2_USE_EXTERNAL_PUGIXML:BOOL=OFF
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
MPIEXEC_EXTRA_FLAGS:STRING=--allow-run-as-root --oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=${N2CPUS}
")
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/cmake/ci-el7.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} -Werror)
set(ENV{CXXFLAGS} -Werror)
set(ENV{FFLAGS} -Werror)

set(dashboard_cache "
ADIOS2_USE_BZip2:STRING=ON
Expand All @@ -16,6 +13,9 @@ ADIOS2_USE_MPI:STRING=OFF
ADIOS2_USE_Python:STRING=ON
ADIOS2_USE_ZeroMQ:STRING=ON
ADIOS2_USE_ZFP:STRING=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
")

set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/cmake/ci-macos1014-xcode103-ninja.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_MPI:BOOL=OFF
ADIOS2_USE_Python:BOOL=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
")

set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.14")
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/cmake/ci-macos1014-xcode103-openmpi-make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_MPI:STRING=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
MPIEXEC_EXTRA_FLAGS:STRING=--oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=4
")
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/cmake/ci-macos1015-xcode111-make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_MPI:BOOL=OFF
ADISO2_USE_Python:BOOL=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
")

set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.15")
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/cmake/ci-macos1015-xcode111-openmpi-ninja.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_MPI:STRING=ON
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
MPIEXEC_EXTRA_FLAGS:STRING=--oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=4
")
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/cmake/ci-ubuntu1804-spack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ math(EXPR N2CPUS "${NCPUS}*2")
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand All @@ -29,6 +26,9 @@ ADIOS2_USE_EXTERNAL_DEPENDENCIES:BOOL=ON
ADIOS2_USE_EXTERNAL_GTEST:BOOL=OFF
ADIOS2_USE_EXTERNAL_PUGIXML:BOOL=OFF
CMAKE_C_FLAGS:STRING=-Wall
CMAKE_CXX_FLAGS:STRING=-Wall
MPIEXEC_EXTRA_FLAGS:STRING=--allow-run-as-root --oversubscribe
MPIEXEC_MAX_NUMPROCS:STRING=${N2CPUS}
")
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/engine/bp5/BP5Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace engine
BP5Reader::BP5Reader(IO &io, const std::string &name, const Mode mode,
helper::Comm comm)
: Engine("BP5Reader", io, name, mode, std::move(comm)), m_MDFileManager(m_Comm),
m_FileMetaMetadataManager(m_Comm), m_DataFileManager(m_Comm),
m_MDIndexFileManager(m_Comm), m_ActiveFlagFileManager(m_Comm)
m_DataFileManager(m_Comm), m_MDIndexFileManager(m_Comm),
m_FileMetaMetadataManager(m_Comm), m_ActiveFlagFileManager(m_Comm)
{
PERFSTUBS_SCOPED_TIMER("BP5Reader::Open");
Init();
Expand Down Expand Up @@ -158,7 +158,7 @@ void BP5Reader::ReadData(const size_t WriterRank, const size_t Timestep,
size_t RemainingLength = Length;
size_t ThisDataPos;
size_t Offset = StartOffset;
for (int flush = 0; flush < FlushCount; flush++)
for (size_t flush = 0; flush < FlushCount; flush++)
{

ThisDataPos =
Expand Down
5 changes: 3 additions & 2 deletions source/adios2/engine/bp5/BP5Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ BP5Writer::BP5Writer(IO &io, const std::string &name, const Mode mode,
helper::Comm comm)
: Engine("BP5Writer", io, name, mode, std::move(comm)), m_BP5Serializer(),
m_FileDataManager(m_Comm), m_FileMetadataManager(m_Comm),
m_FileMetaMetadataManager(m_Comm), m_FileMetadataIndexManager(m_Comm)
m_FileMetadataIndexManager(m_Comm), m_FileMetaMetadataManager(m_Comm)
{
PERFSTUBS_SCOPED_TIMER("BP5Writer::Open");
m_IO.m_ReadStreaming = false;
Expand Down Expand Up @@ -138,6 +138,7 @@ uint64_t BP5Writer::WriteMetadata(
void BP5Writer::WriteData(format::BufferV *Data)
{
format::BufferV::BufferV_iovec DataVec = Data->DataVec();
(void)DataVec;
switch (m_Parameters.AggregationType)
{
case (int)AggregationType::EveryoneWrites:
Expand Down Expand Up @@ -512,6 +513,7 @@ void BP5Writer::InitAggregator()
else
{
size_t numNodes = m_AggregatorTwoLevelShm.PreInit(m_Comm);
(void)numNodes;
m_AggregatorTwoLevelShm.Init(m_Parameters.NumAggregators,
m_Parameters.NumSubFiles, m_Comm);

Expand Down Expand Up @@ -640,7 +642,6 @@ void BP5Writer::InitTransports()
m_FileMetadataManager.OpenFiles(m_MetadataFileNames, m_OpenMode,
m_IO.m_TransportsParameters, false);

uint64_t WriterCount = m_Comm.Size();
m_FileMetadataIndexManager.OpenFiles(
m_MetadataIndexFileNames, m_OpenMode, m_IO.m_TransportsParameters,
false);
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/engine/dataman/DataManMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <fstream>
#include <iostream>
#include <math.h>
#include <nlohmann/json.hpp>
#include <nlohmann_json.hpp>

namespace adios2
{
Expand Down
1 change: 0 additions & 1 deletion source/adios2/engine/dataman/DataManMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class DataManMonitor
bool m_WriterThreading = false;

bool m_Verbose = true;
bool m_JsonOutput = true;
};

} // end namespace engine
Expand Down
Loading

0 comments on commit 52cf30a

Please sign in to comment.