Skip to content

Commit

Permalink
Remove warnings
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 10, 2021
1 parent 64393fe commit e88d4f7
Show file tree
Hide file tree
Showing 30 changed files with 244 additions and 28 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 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
1 change: 0 additions & 1 deletion source/adios2/engine/dataman/DataManMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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 @@ -425,7 +425,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
4 changes: 2 additions & 2 deletions source/adios2/engine/table/TableWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void TableWriter::PutAggregatorBuffer()
{
m_VarInfoMap[v.name].type = v.type;
m_VarInfoMap[v.name].shape = v.shape;
size_t elementSize;
size_t elementSize = 0;
if (v.type == DataType::None)
{
}
Expand Down Expand Up @@ -522,7 +522,7 @@ std::vector<std::string> TableWriter::WhatAggregatorAddresses(const Dims &start,
if (m_Verbosity >= 10)
{
std::cout << "TableWriter::WhatAggregators returns ";
for (const auto i : aggregators)
for (const auto& i : aggregators)
{
std::cout << i << ", ";
}
Expand Down
1 change: 0 additions & 1 deletion source/adios2/engine/table/TableWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class TableWriter : public Engine
int m_MpiRank;
int m_MpiSize;
int m_CurrentStep = -1;
size_t m_AppID;
std::thread m_ReplyThread;
bool m_IsRowMajor;
ADIOS m_SubAdios;
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 @@ -568,7 +568,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 @@ -611,7 +611,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 @@ -652,7 +652,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 @@ -682,7 +682,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 @@ -708,7 +708,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 @@ -739,7 +739,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 @@ -775,7 +775,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 @@ -812,7 +812,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 @@ -392,7 +392,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 @@ -89,7 +89,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
1 change: 0 additions & 1 deletion source/adios2/toolkit/zmq/zmqreqrep/ZmqReqRep.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ZmqReqRep
void SendReply(const void *reply, const size_t size);

private:
int m_Verbosity = 0;
int m_Timeout;

std::vector<char> m_ReceiverBuffer;
Expand Down
23 changes: 23 additions & 0 deletions testing/adios2/engine/bp/TestBPWriteAppendReadADIOS2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@

#include "../SmallTestData.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"
#pragma GCC diagnostic ignored "-Wunused-variable"

#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-aliasing"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif

std::string engineName; // comes from command line

class BPWriteAppendReadTestADIOS2 : public ::testing::Test
Expand Down Expand Up @@ -733,3 +747,12 @@ int main(int argc, char **argv)

return result;
}

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

21 changes: 21 additions & 0 deletions testing/adios2/engine/bp/TestBPWriteReadAsStreamADIOS2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@

#include "../SmallTestData.h"

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

#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
#endif

std::string engineName; // comes from command line

class BPWriteReadAsStreamTestADIOS2 : public ::testing::Test
Expand Down Expand Up @@ -1070,3 +1082,12 @@ int main(int argc, char **argv)

return result;
}

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

22 changes: 22 additions & 0 deletions testing/adios2/engine/bp/TestBPWriteReadAttributesMultirank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@

#include <gtest/gtest.h>

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

#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
#endif


std::string engineName; // comes from command line

class BPWriteReadAttributeTestMultirank : public ::testing::Test
Expand Down Expand Up @@ -137,3 +150,12 @@ int main(int argc, char **argv)

return result;
}

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

Loading

0 comments on commit e88d4f7

Please sign in to comment.