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 <[email protected]>
  • Loading branch information
Chuck Atkins authored and vicentebolea committed Jun 15, 2021
1 parent 4056265 commit 74e12ac
Show file tree
Hide file tree
Showing 44 changed files with 283 additions and 50 deletions.
22 changes: 22 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,19 @@

#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 +195,13 @@ 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
1 change: 1 addition & 0 deletions examples/basics/values/values_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ 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
1 change: 1 addition & 0 deletions examples/hello/bpWriter/helloBPSubStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ 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
1 change: 1 addition & 0 deletions examples/hello/bpWriter/helloBPWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ 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 -Wall -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 -Wall -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 -Wall -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
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 @@ -7,6 +7,9 @@ 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(ENV{FFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
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,9 @@
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(ENV{FFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_BZip2:STRING=ON
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 @@ -2,6 +2,9 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")
set(ENV{FFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
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 @@ -2,6 +2,9 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")
set(ENV{FFLAGS} "-Werror -Wall")

include(ProcessorCount)
ProcessorCount(NCPUS)
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 @@ -2,6 +2,9 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")
set(ENV{FFLAGS} "-Werror -Wall")

set(dashboard_cache "
ADIOS2_USE_Fortran:BOOL=ON
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 @@ -2,6 +2,9 @@
set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ENV{FC} gfortran)
set(ENV{CFLAGS} "-Werror -Wall")
set(ENV{CXXFLAGS} "-Werror -Wall")
set(ENV{FFLAGS} "-Werror -Wall")

include(ProcessorCount)
ProcessorCount(NCPUS)
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,9 @@ 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(ENV{FFLAGS} "-Werror -Wall -Wno-error=builtin-declaration-mismatch")

set(dashboard_cache "
ADIOS2_USE_BZip2:BOOL=ON
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
2 changes: 1 addition & 1 deletion 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
16 changes: 8 additions & 8 deletions source/adios2/helper/adiosMemory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ void Resize(std::vector<T> &vec, const size_t dataSize, const std::string hint,
// functions) and copies to the output buffer in blocks. the memory address
// calculation complexity for copying each block is minimized to O(1), which is
// independent of the number of dimensions.
static void NdCopyRecurDFSeqPadding(size_t curDim, const char *&inOvlpBase,
static inline void NdCopyRecurDFSeqPadding(size_t curDim, const char *&inOvlpBase,
char *&outOvlpBase, Dims &inOvlpGapSize,
Dims &outOvlpGapSize, Dims &ovlpCount,
size_t &minContDim, size_t &blockSize)
Expand Down Expand Up @@ -666,7 +666,7 @@ static void NdCopyRecurDFSeqPadding(size_t curDim, const char *&inOvlpBase,
// each element is minimized to average O(1), which is independent of
// the number of dimensions.

static void
static inline void
NdCopyRecurDFSeqPaddingRevEndian(size_t curDim, const char *&inOvlpBase,
char *&outOvlpBase, Dims &inOvlpGapSize,
Dims &outOvlpGapSize, Dims &ovlpCount,
Expand Down Expand Up @@ -707,7 +707,7 @@ NdCopyRecurDFSeqPaddingRevEndian(size_t curDim, const char *&inOvlpBase,
// used for buffer of Column major
// the memory address calculation complexity for copying each element is
// minimized to average O(1), which is independent of the number of dimensions.
static void NdCopyRecurDFNonSeqDynamic(size_t curDim, const char *inBase,
static inline void NdCopyRecurDFNonSeqDynamic(size_t curDim, const char *inBase,
char *outBase, Dims &inRltvOvlpSPos,
Dims &outRltvOvlpSPos, Dims &inStride,
Dims &outStride, Dims &ovlpCount,
Expand Down Expand Up @@ -737,7 +737,7 @@ static void NdCopyRecurDFNonSeqDynamic(size_t curDim, const char *inBase,
// The memory address calculation complexity for copying each element is
// minimized to average O(1), which is independent of the number of dimensions.

static void NdCopyRecurDFNonSeqDynamicRevEndian(
static inline void NdCopyRecurDFNonSeqDynamicRevEndian(
size_t curDim, const char *inBase, char *outBase, Dims &inRltvOvlpSPos,
Dims &outRltvOvlpSPos, Dims &inStride, Dims &outStride, Dims &ovlpCount,
size_t elmSize)
Expand All @@ -763,7 +763,7 @@ static void NdCopyRecurDFNonSeqDynamicRevEndian(
}
}

static void NdCopyIterDFSeqPadding(const char *&inOvlpBase, char *&outOvlpBase,
static inline void NdCopyIterDFSeqPadding(const char *&inOvlpBase, char *&outOvlpBase,
Dims &inOvlpGapSize, Dims &outOvlpGapSize,
Dims &ovlpCount, size_t minContDim,
size_t blockSize)
Expand Down Expand Up @@ -794,7 +794,7 @@ static void NdCopyIterDFSeqPadding(const char *&inOvlpBase, char *&outOvlpBase,
}
}

static void NdCopyIterDFSeqPaddingRevEndian(
static inline void NdCopyIterDFSeqPaddingRevEndian(
const char *&inOvlpBase, char *&outOvlpBase, Dims &inOvlpGapSize,
Dims &outOvlpGapSize, Dims &ovlpCount, size_t minContDim, size_t blockSize,
size_t elmSize, size_t numElmsPerBlock)
Expand Down Expand Up @@ -830,7 +830,7 @@ static void NdCopyIterDFSeqPaddingRevEndian(
} while (pos[curDim] == ovlpCount[curDim]);
}
}
static void NdCopyIterDFDynamic(const char *inBase, char *outBase,
static inline void NdCopyIterDFDynamic(const char *inBase, char *outBase,
Dims &inRltvOvlpSPos, Dims &outRltvOvlpSPos,
Dims &inStride, Dims &outStride,
Dims &ovlpCount, size_t elmSize)
Expand Down Expand Up @@ -867,7 +867,7 @@ static void NdCopyIterDFDynamic(const char *inBase, char *outBase,
}
}

static void NdCopyIterDFDynamicRevEndian(const char *inBase, char *outBase,
static inline void NdCopyIterDFDynamicRevEndian(const char *inBase, char *outBase,
Dims &inRltvOvlpSPos,
Dims &outRltvOvlpSPos, Dims &inStride,
Dims &outStride, Dims &ovlpCount,
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/helper/adiosType.inl
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ inline std::string VectorToCSV(const std::vector<std::string> &input) noexcept
}

std::ostringstream valueSS;
for (const auto value : input)
for (const auto& value : input)
{
valueSS << "\"" << value << "\", ";
}
Expand All @@ -200,7 +200,7 @@ inline std::string VectorToCSV(const std::vector<std::string> &input) noexcept
} \
\
std::ostringstream valueSS; \
for (const auto value : input) \
for (const auto& value : input) \
{ \
const int valueInt = static_cast<int>(value); \
valueSS << valueInt << ", "; \
Expand All @@ -223,7 +223,7 @@ inline std::string VectorToCSV(const std::vector<T> &input) noexcept
}

std::ostringstream valueSS;
for (const auto value : input)
for (const auto& value : input)
{
valueSS << value << ", ";
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/format/bp/BPBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ BPBase::GetTransportIDs(const std::vector<std::string> &transportsTypes) const
std::vector<uint8_t> transportsIDs;
transportsIDs.reserve(transportsTypes.size());

for (const std::string transportType : transportsTypes)
for (const std::string& transportType : transportsTypes)
{
transportsIDs.push_back(lf_GetTransportID(transportType));
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/format/dataman/DataManSerializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ int DataManSerializer::GetData(T *outputData, const std::string &varName,
}
if (j.shape.empty() or (j.shape.size() == 1 and j.shape[0] == 1))
{
std::memcpy(outputData, input_data, sizeof(T));
std::memcpy(reinterpret_cast<char *>(outputData), input_data, sizeof(T));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/profiling/taustubs/tautimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void (*my_Tau_destructor_trigger)(void) = NULL;
static void initialize_library(void)
{
// initialize the library when it is loaded
static taustubs::TauTimer &tt = taustubs::TauTimer::get();
taustubs::TauTimer::get();
}

void open_preload_libraries(void)
Expand Down
7 changes: 4 additions & 3 deletions source/adios2/toolkit/sst/dp/rdma_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ static void *RdmaReadRemoteMemory(CP_Services Svcs, DP_RS_Stream Stream_v,
size_t Length, void *Buffer,
void *DP_TimestepInfo)
{
RdmaCompletionHandle ret;
RdmaCompletionHandle ret = {0};
Rdma_RS_Stream RS_Stream = (Rdma_RS_Stream)Stream_v;
RdmaBufferHandle Info = (RdmaBufferHandle)DP_TimestepInfo;
RdmaStepLogEntry StepLog;
Expand Down Expand Up @@ -1540,9 +1540,10 @@ static void RdmaDestroyReader(CP_Services Svcs, DP_RS_Stream RS_Stream_v)
static void RdmaDestroyWriterPerReader(CP_Services Svcs,
DP_WSR_Stream WSR_Stream_v)
{
Rdma_WSR_Stream WSR_Stream = (Rdma_WSR_Stream)WSR_Stream_v;
Rdma_WSR_Stream WSR_Stream = {0};
memcpy(&WSR_Stream, &WSR_Stream_v, sizeof(Rdma_WSR_Stream));
Rdma_WS_Stream WS_Stream = WSR_Stream->WS_Stream;
RdmaWriterContactInfo WriterContactInfo;
RdmaWriterContactInfo WriterContactInfo = {0};

pthread_mutex_lock(&wsr_mutex);
for (int i = 0; i < WS_Stream->ReaderCount; i++)
Expand Down
Loading

0 comments on commit 74e12ac

Please sign in to comment.