Skip to content

Commit

Permalink
CI: Enforce -Wall and -Werror
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
  • Loading branch information
vicentebolea committed Jun 16, 2021
1 parent 4056265 commit 66d76e2
Show file tree
Hide file tree
Showing 61 changed files with 328 additions and 112 deletions.
20 changes: 20 additions & 0 deletions bindings/CXX11/adios2/cxx11/fstream/ADIOS2fstream.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@

#include "adios2/core/Stream.h"

#if defined(_MSC_VER)
#pragma warning(push)
//#pragma warning( disable : 4101)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"

#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-wstrict-aliasing"
#endif

namespace adios2
{

Expand Down Expand Up @@ -182,4 +194,12 @@ std::vector<T> fstream::read_attribute(const std::string &name,

} // end namespace adios2

#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#endif

#endif /* ADIOS2_BINDINGS_CXX11_CXX11_FSTREAM_ADIOS2FSTREAM_TCC_ */
1 change: 1 addition & 0 deletions cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ if(ADIOS2_USE_Fortran STREQUAL AUTO)
endif()
elseif(ADIOS2_USE_Fortran)
enable_language(Fortran)
#string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -Wall")
endif()
if(CMAKE_Fortran_COMPILER_LOADED)
set(ADIOS2_HAVE_Fortran TRUE)
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
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
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
6 changes: 3 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,9 @@ 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(ENV{CFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
6 changes: 3 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,9 @@ 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(ENV{CFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
BUILD_SHARED_LIBS:BOOL=OFF
Expand Down
6 changes: 3 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,9 @@ 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(ENV{CFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{FFLAGS} "-Werror -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/cmake/ci-el7-intel-ohpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")
set(ENV{FFLAGS} "-warn errors")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
6 changes: 3 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,9 @@ 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(ENV{CFLAGS} "-Werror -Wall -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall -Wall")
set(ENV{FFLAGS} "-warn errors")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/ci-el7-spack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ math(EXPR N2CPUS "${NCPUS}*2")
set(ENV{CC} gcc)
set(ENV{CXX} g++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/cmake/ci-el7.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
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(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_BZip2:STRING=ON
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/ci-macos1014-xcode103-ninja.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/ci-macos1014-xcode103-openmpi-make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

include(ProcessorCount)
ProcessorCount(NCPUS)
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/ci-macos1015-xcode111-make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/ci-macos1015-xcode111-openmpi-ninja.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")

include(ProcessorCount)
ProcessorCount(NCPUS)
Expand Down
5 changes: 2 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,8 @@ 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(ENV{CFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")
set(ENV{CXXFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
Expand Down
12 changes: 6 additions & 6 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)
{
TAU_SCOPED_TIMER("BP5Reader::Open");
Init();
Expand Down Expand Up @@ -95,7 +95,7 @@ StepStatus BP5Reader::BeginStep(StepMode mode, const float timeoutSeconds)
size_t pgstart = m_MetadataIndexTable[m_CurrentStep][0];
size_t Position = pgstart + sizeof(uint64_t); // skip total data size
size_t MDPosition = Position + 2 * sizeof(uint64_t) * m_WriterCount;
for (int i = 0; i < m_WriterCount; i++)
for (size_t i = 0; i < m_WriterCount; i++)
{
// variable metadata for timestep
size_t ThisMDSize = helper::ReadValue<uint64_t>(
Expand All @@ -104,7 +104,7 @@ StepStatus BP5Reader::BeginStep(StepMode mode, const float timeoutSeconds)
m_BP5Deserializer->InstallMetaData(ThisMD, ThisMDSize, i);
MDPosition += ThisMDSize;
}
for (int i = 0; i < m_WriterCount; i++)
for (size_t i = 0; i < m_WriterCount; i++)
{
// attribute metadata for timestep
size_t ThisADSize = helper::ReadValue<uint64_t>(
Expand Down Expand Up @@ -607,8 +607,8 @@ void BP5Reader::ParseMetadataIndex(format::BufferSTL &bufferSTL,
for (uint64_t i = 0; i < m_WriterCount; i++)
{
size_t DataPosPos = ptrs[2] + sizeof(uint64_t) * i;
const uint64_t DataPos = helper::ReadValue<uint64_t>(
buffer, DataPosPos, m_Minifooter.IsLittleEndian);
helper::ReadValue<uint64_t>(buffer, DataPosPos,
m_Minifooter.IsLittleEndian);
}

position += sizeof(uint64_t) * m_WriterCount;
Expand Down
8 changes: 4 additions & 4 deletions source/adios2/engine/bp5/BP5Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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)
{
TAU_SCOPED_TIMER("BP5Writer::Open");
m_IO.m_ReadStreaming = false;
Expand Down Expand Up @@ -147,7 +147,7 @@ void BP5Writer::WriteMetadataFileIndex(uint64_t MetaDataPos,
m_FileMetadataIndexManager.WriteFiles((char *)buf, sizeof(buf));
m_FileMetadataIndexManager.WriteFiles((char *)m_WriterDataPos.data(),
DataSizes.size() * sizeof(uint64_t));
for (int i = 0; i < DataSizes.size(); i++)
for (size_t i = 0; i < DataSizes.size(); i++)
{
m_WriterDataPos[i] += DataSizes[i];
}
Expand Down Expand Up @@ -382,7 +382,7 @@ void BP5Writer::InitTransports()
m_FileMetadataManager.OpenFiles(m_MetadataFileNames, m_OpenMode,
m_IO.m_TransportsParameters, false);

uint64_t WriterCount = m_Comm.Size();
// m_Comm.Size();
m_FileMetadataIndexManager.OpenFiles(
m_MetadataIndexFileNames, m_OpenMode, m_IO.m_TransportsParameters,
false);
Expand Down Expand Up @@ -547,7 +547,7 @@ void BP5Writer::InitBPBuffer()
m_FileMetadataIndexManager.WriteFiles(bi.m_Buffer.data(),
bi.m_Position);
std::vector<uint64_t> Assignment(m_Comm.Size());
for (uint64_t i = 0; i < m_Comm.Size(); i++)
for (uint64_t i = 0; i < static_cast<uint64_t>(m_Comm.Size()); i++)
{
Assignment[i] = i; // Change when we do aggregation
}
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
4 changes: 2 additions & 2 deletions source/adios2/engine/hdf5/HDF5ReaderP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ size_t HDF5ReaderP::ReadDataset(hid_t dataSetId, hid_t h5Type,
size_t typesize = H5Tget_size(h5Type);

char *val = (char *)(calloc(typesize, sizeof(char)));
hid_t ret2 = H5Dread(dataSetId, h5Type, memDataSpace, fileSpace,
H5P_DEFAULT, val);
H5Dread(dataSetId, h5Type, memDataSpace, fileSpace, H5P_DEFAULT,
val);

((std::string *)values)->assign(val, typesize);
free(val);
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/engine/ssc/SscHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void AggregateMetadata(const Buffer &localBuffer, Buffer &globalBuffer,
globalBuffer.resize(globalSize + 10);

std::vector<int> displs(mpiSize);
for (size_t i = 1; i < mpiSize; ++i)
for (size_t i = 1; i < static_cast<size_t>(mpiSize); ++i)
{
displs[i] = displs[i - 1] + localSizes[i - 1];
}
Expand All @@ -438,7 +438,7 @@ void BroadcastMetadata(Buffer &globalBuffer, const int root, MPI_Comm comm)
{
int globalBufferSize = static_cast<int>(globalBuffer.size());
MPI_Bcast(&globalBufferSize, 1, MPI_INT, root, comm);
if (globalBuffer.size() < globalBufferSize)
if (globalBuffer.size() < static_cast<size_t>(globalBufferSize))
{
globalBuffer.resize(globalBufferSize);
}
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/engine/sst/SstReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void SstReader::Init()
size_t *Start = NULL; \
size_t *Count = NULL; \
size_t DimCount = 0; \
int NeedSync; \
int NeedSync = 0; \
\
if (variable.m_SelectionType == \
adios2::SelectionType::BoundingBox) \
Expand Down Expand Up @@ -586,7 +586,7 @@ void SstReader::Init()
} \
if (m_WriterMarshalMethod == SstMarshalBP5) \
{ \
bool need_sync = m_BP5Deserializer->QueueGet(variable, data); \
m_BP5Deserializer->QueueGet(variable, data); \
} \
}
ADIOS2_FOREACH_STDTYPE_1ARG(declare_gets)
Expand Down
Loading

0 comments on commit 66d76e2

Please sign in to comment.