Skip to content

Commit

Permalink
Merge pull request #2639 from chuckatkins/ci-wall
Browse files Browse the repository at this point in the history
Address compile warnings across the project (Former: Enable -Wall)
  • Loading branch information
Chuck Atkins authored Jun 14, 2021
2 parents 97ff73b + 667835d commit fef6758
Show file tree
Hide file tree
Showing 61 changed files with 1,075 additions and 564 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ if(MSVC)
)
endif()

function(append_str_list_once var x)
foreach(item IN ITEMS ${${var}})
if(item STREQUAL x)
return()
endif()
endforeach()
set(out ${${var}} ${x})
string(REPLACE ";" " " out "${out}")
set(${var} "${out}" PARENT_SCOPE)
endfunction()

if(NOT MSVC)
set(CMAKE_C_COMPILER_FLAGS_DEBUG "${CMAKE_C_COMPILER_FLAGS_DEBUG}"
CACHE STRING "" FORCE
)
set(CMAKE_CXX_COMPILER_FLAGS_DEBUG "${CMAKE_CXX_COMPILER_FLAGS_DEBUG}"
CACHE STRING "" FORCE
)
endif()

#------------------------------------------------------------------------------#
# Deal with any pre-installation cleanup tasks
#------------------------------------------------------------------------------#
Expand Down
1 change: 0 additions & 1 deletion bindings/CXX11/adios2/cxx11/Engine.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ template <class T>
void Engine::Get(Variable<T> variable, typename Variable<T>::Info &info,
const Mode launch)
{
using IOType = typename TypeInfo<T>::IOType;
adios2::helper::CheckForNullptr(m_Engine, "in call to Engine::Get");
if (m_Engine->m_EngineType == "NULL")
{
Expand Down
4 changes: 4 additions & 0 deletions examples/heatTransfer/write/IO_ph5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ void HDF5NativeWriter::WriteScalar(const std::string &varName, const void *data,

herr_t status = H5Dwrite(dsetID, h5Type, H5S_ALL, H5S_ALL, plistID, data);

if (status < 0)
{
std::cerr << " Write failed. " << std::endl;
}
H5Sclose(filespaceID);
H5Dclose(dsetID);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/hdf5Writer/helloHDF5Writer_nompi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(int argc, char *argv[])
hdf5IO.Open("myVector.h5", adios2::Mode::Write);

/** Write variable for buffering */
hdf5Writer.Get<float>(bpFloats, myFloats.data());
hdf5Writer.Put<float>(bpFloats, myFloats.data());

/** Create bp file, engine becomes unreachable after this*/
hdf5Writer.Close();
Expand Down
3 changes: 3 additions & 0 deletions examples/query/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ bool testMe(std::string &queryConfigFile, std::string const &doubleVarName,
adios2::IO inIO = ad.DeclareIO("query");
adios2::Engine reader = inIO.Open(dataFileName, adios2::Mode::Read, comm);

// to be continued
if (!reader)
return false;
// std::vector<double> dataOutput;
// std::vector<adios2::Dims> coordinateOutput;

Expand Down
32 changes: 0 additions & 32 deletions scripts/ci/cmake/ci-el7-intel18-ohpc.cmake

This file was deleted.

42 changes: 0 additions & 42 deletions scripts/ci/cmake/ci-el7-intel18-openmpi-ohpc.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions source/adios2/core/ADIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ namespace core

ADIOS::ADIOS(const std::string configFile, helper::Comm comm,
const std::string hostLanguage)
: m_ConfigFile(configFile), m_HostLanguage(hostLanguage),
m_Comm(std::move(comm))
: m_HostLanguage(hostLanguage), m_Comm(std::move(comm)),
m_ConfigFile(configFile)
{
if (!configFile.empty())
{
Expand Down
52 changes: 3 additions & 49 deletions source/adios2/core/Attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,15 @@
#include "Attribute.tcc"

#include "adios2/common/ADIOSMacros.h"
#include "adios2/helper/adiosFunctions.h" //GetDataType<T>

#include <type_traits>

namespace adios2
{
namespace core
{

namespace // anonymous
{

template <class T>
struct RequiresZeroPadding : std::false_type
{
};

template <>
struct RequiresZeroPadding<long double> : std::true_type
{
};
}

#define declare_type(T) \
\
template <> \
Attribute<T>::Attribute(const Attribute<T> &other) \
: AttributeBase(other), m_DataArray(other.m_DataArray) \
{ \
if (RequiresZeroPadding<T>::value) \
std::memset(&m_DataSingleValue, 0, sizeof(m_DataSingleValue)); \
m_DataSingleValue = other.m_DataSingleValue; \
} \
\
template <> \
Attribute<T>::Attribute(const std::string &name, const T *array, \
const size_t elements) \
: AttributeBase(name, helper::GetDataType<T>(), elements) \
{ \
if (RequiresZeroPadding<T>::value) \
std::memset(&m_DataSingleValue, 0, sizeof(m_DataSingleValue)); \
m_DataArray = std::vector<T>(array, array + elements); \
} \
\
template <> \
Attribute<T>::Attribute(const std::string &name, const T &value) \
: AttributeBase(name, helper::GetDataType<T>()) \
{ \
if (RequiresZeroPadding<T>::value) \
std::memset(&m_DataSingleValue, 0, sizeof(m_DataSingleValue)); \
m_DataSingleValue = value; \
}

ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_1ARG(declare_type)
#undef declare_type
#define declare_template_instantiation(T) template class Attribute<T>;
ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation

} // end namespace core
} // end namespace adios2
64 changes: 63 additions & 1 deletion source/adios2/core/Attribute.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,76 @@

#include "Attribute.h"

#include "adios2/helper/adiosFunctions.h" //GetDataType<T>
#include "adios2/helper/adiosType.h"

#include <cstring>

#include <type_traits>

namespace adios2
{
namespace core
{

template <class T>
namespace // anonymous
{
template <typename T, typename Enable = void>
struct Pad;

template <typename T, typename Enable>
struct Pad
{
static void Zero(T &arg) {}
};

template <typename T>
struct Pad<T, typename std::enable_if<std::is_trivial<T>::value>::type>
{
static void Zero(T &arg) { std::memset(&arg, 0, sizeof(arg)); }
};

template <typename T>
struct Pad<T, typename std::enable_if<std::is_same<
T, std::complex<typename T::value_type>>::value>::type>
{
static void Zero(T &arg)
{
Pad<typename T::value_type>::Zero(
reinterpret_cast<typename T::value_type(&)[2]>(arg)[0]);
Pad<typename T::value_type>::Zero(
reinterpret_cast<typename T::value_type(&)[2]>(arg)[1]);
}
};

}

template <typename T>
Attribute<T>::Attribute(const Attribute<T> &other)
: AttributeBase(other), m_DataArray(other.m_DataArray)
{
Pad<T>::Zero(m_DataSingleValue);
m_DataSingleValue = other.m_DataSingleValue;
}

template <typename T>
Attribute<T>::Attribute(const std::string &name, const T *array,
const size_t elements)
: AttributeBase(name, helper::GetDataType<T>(), elements)
{
Pad<T>::Zero(m_DataSingleValue);
m_DataArray = std::vector<T>(array, array + elements);
}

template <typename T>
Attribute<T>::Attribute(const std::string &name, const T &value)
: AttributeBase(name, helper::GetDataType<T>())
{
Pad<T>::Zero(m_DataSingleValue);
m_DataSingleValue = value;
}

template <typename T>
std::string Attribute<T>::DoGetInfoValue() const noexcept
{
std::string value;
Expand Down
6 changes: 2 additions & 4 deletions source/adios2/core/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ void IO::RegisterEngine(const std::string &engineType, EngineFactoryEntry entry)

IO::IO(ADIOS &adios, const std::string name, const bool inConfigFile,
const std::string hostLanguage)
: m_ADIOS(adios), m_Name(name), m_InConfigFile(inConfigFile),
m_HostLanguage(hostLanguage)
: m_ADIOS(adios), m_Name(name), m_HostLanguage(hostLanguage),
m_InConfigFile(inConfigFile)
{
}

Expand Down Expand Up @@ -716,7 +716,6 @@ void IO::ResetVariablesStepSelection(const bool zeroStart,
for (auto itVariable = m_Variables.begin(); itVariable != m_Variables.end();
++itVariable)
{
const std::string &name = itVariable->first;
const DataType type = InquireVariableType(itVariable);

if (type == DataType::None)
Expand Down Expand Up @@ -745,7 +744,6 @@ void IO::SetPrefixedNames(const bool isStep) noexcept
for (auto itVariable = m_Variables.begin(); itVariable != m_Variables.end();
++itVariable)
{
const std::string &name = itVariable->first;
// if for each step (BP4), check if variable type is not empty (means
// variable exist in that step)
const DataType type = isStep ? InquireVariableType(itVariable)
Expand Down
10 changes: 5 additions & 5 deletions source/adios2/core/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace core

Stream::Stream(const std::string &name, const Mode mode, helper::Comm comm,
const std::string engineType, const std::string hostLanguage)
: m_Name(name), m_ADIOS(std::make_shared<ADIOS>(std::move(comm), hostLanguage)),
m_IO(&m_ADIOS->DeclareIO(name)), m_Mode(mode), m_EngineType(engineType)
: m_ADIOS(std::make_shared<ADIOS>(std::move(comm), hostLanguage)),
m_IO(&m_ADIOS->DeclareIO(name)), m_Name(name), m_Mode(mode),
m_EngineType(engineType)
{
if (mode == adios2::Mode::Read)
{
Expand All @@ -38,9 +39,8 @@ Stream::Stream(const std::string &name, const Mode mode,
Stream::Stream(const std::string &name, const Mode mode, helper::Comm comm,
const std::string configFile, const std::string ioInConfigFile,
const std::string hostLanguage)
: m_Name(name),
m_ADIOS(std::make_shared<ADIOS>(configFile, std::move(comm), hostLanguage)),
m_IO(&m_ADIOS->DeclareIO(ioInConfigFile)), m_Mode(mode)
: m_ADIOS(std::make_shared<ADIOS>(configFile, std::move(comm), hostLanguage)),
m_IO(&m_ADIOS->DeclareIO(ioInConfigFile)), m_Name(name), m_Mode(mode)
{
if (mode == adios2::Mode::Read)
{
Expand Down
1 change: 0 additions & 1 deletion source/adios2/engine/bp4/BP4Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ size_t BP4Reader::UpdateBuffer(const TimePoint &timeoutInstant,
* Those steps are read again here, starting in the beginning of
* the buffer now.
*/
const size_t fileSize = m_MDFileManager.GetFileSize(0);
const size_t newMDSize =
expectedMinFileSize - m_MDFileAlreadyReadSize;
if (m_BP4Deserializer.m_Metadata.m_Buffer.size() < newMDSize)
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/engine/dataman/DataManReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ namespace engine
DataManReader::DataManReader(IO &io, const std::string &name,
const Mode openMode, helper::Comm comm)
: Engine("DataManReader", io, name, openMode, std::move(comm)),
m_FinalStep(std::numeric_limits<signed long int>::max()),
m_Serializer(m_Comm, helper::IsRowMajor(io.m_HostLanguage)),
m_RequesterThreadActive(true), m_SubscriberThreadActive(true),
m_FinalStep(std::numeric_limits<signed long int>::max())
m_RequesterThreadActive(true), m_SubscriberThreadActive(true)
{
m_MpiRank = m_Comm.Rank();
m_MpiSize = m_Comm.Size();
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/engine/dataman/DataManWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace engine

DataManWriter::DataManWriter(IO &io, const std::string &name,
const Mode openMode, helper::Comm comm)
: Engine("DataManWriter", io, name, openMode, std::move(comm)),
m_Serializer(m_Comm, helper::IsRowMajor(io.m_HostLanguage)), m_SentSteps(0),
: Engine("DataManWriter", io, name, openMode, std::move(comm)), m_SentSteps(0),
m_Serializer(m_Comm, helper::IsRowMajor(io.m_HostLanguage)),
m_ReplyThreadActive(true), m_PublishThreadActive(true)
{

Expand Down
Loading

0 comments on commit fef6758

Please sign in to comment.