Skip to content

Commit

Permalink
fix type warning and enum conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonRuonanWang committed Apr 2, 2022
1 parent 8121b20 commit d0a0241
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 26 deletions.
4 changes: 2 additions & 2 deletions source/adios2/engine/ssc/SscReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ StepStatus SscReader::BeginStep(const StepMode stepMode,
{
helper::Log("Engine", "SSCReader", "BeginStep",
"unknown data type", 0, m_Comm.Rank(), 0,
m_Verbosity, helper::LogMode::ERROR);
m_Verbosity, helper::FATALERROR);
}
}
}
Expand Down Expand Up @@ -252,7 +252,7 @@ void SscReader::PerformGets()
{
helper::Log("Engine", "SSCReader", "PerformGets",
"unknown data type", 0, m_Comm.Rank(),
0, m_Verbosity, helper::LogMode::ERROR);
0, m_Verbosity, helper::FATALERROR);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/engine/ssc/SscReader.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
{
helper::Log("Engine", "SSCReader", "GetDeferredCommon",
"unknown ShapeID", 0, m_Comm.Rank(), 0,
m_Verbosity, helper::LogMode::ERROR);
m_Verbosity, helper::FATALERROR);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/helper/adiosCommDummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void CommDummyError(const std::string &msg)
helper::Log("Helper", "adiosCommDummy", "CommDummyError",
"CommDummy: a function returned error code '" + msg +
"'. Aborting!",
helper::LogMode::ERROR);
helper::FATALERROR);
std::abort();
}
}
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/helper/adiosLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::string MakeMessage(const std::string &component, const std::string &source,
{
m << warningColor << " [ADIOS2 WARNING]" << defaultColor;
}
else if (mode == ERROR)
else if (mode == FATALERROR)
{
m << errorColor << " [ADIOS2 ERROR]" << defaultColor;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ void Log(const std::string &component, const std::string &source,
if ((logRank >= 0 && commRank >= 0 && logRank != commRank) ||
priority > verbosity ||
(messages.find(message) != messages.end() &&
(mode == LogMode::ERROR || mode == LogMode::WARNING)))
(mode == LogMode::FATALERROR || mode == LogMode::WARNING)))
{
return;
}
Expand All @@ -115,7 +115,7 @@ void Log(const std::string &component, const std::string &source,
{
std::cout << m;
}
else if (mode == ERROR)
else if (mode == FATALERROR)
{
std::cerr << m;
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/helper/adiosLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace helper
enum LogMode : char
{
EXCEPTION = 'x',
ERROR = 'e',
FATALERROR = 'e',
WARNING = 'w',
INFO = 'i'
};
Expand Down
8 changes: 4 additions & 4 deletions source/adios2/helper/adiosSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,25 @@ int ExceptionToError(const std::string &function)
catch (std::invalid_argument &e)
{
helper::Log("Helper", "adiosSystem", "ExceptionToError",
function + ": " + e.what(), helper::LogMode::ERROR);
function + ": " + e.what(), helper::FATALERROR);
return 1;
}
catch (std::system_error &e)
{
helper::Log("Helper", "adiosSystem", "ExceptionToError",
function + ": " + e.what(), helper::LogMode::ERROR);
function + ": " + e.what(), helper::FATALERROR);
return 2;
}
catch (std::runtime_error &e)
{
helper::Log("Helper", "adiosSystem", "ExceptionToError",
function + ": " + e.what(), helper::LogMode::ERROR);
function + ": " + e.what(), helper::FATALERROR);
return 3;
}
catch (std::exception &e)
{
helper::Log("Helper", "adiosSystem", "ExceptionToError",
function + ": " + e.what(), helper::LogMode::ERROR);
function + ": " + e.what(), helper::FATALERROR);
return 4;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/operator/compress/CompressBZIP2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ size_t CompressBZIP2::Operate(const char *dataIn, const Dims &blockStart,

unsigned int sourceOffset = 0;
unsigned int batchInfoOffset = destOffset;
destOffset += batches * 4 * sizeof(unsigned int);
destOffset += static_cast<unsigned int>(batches * 4 * sizeof(unsigned int));

for (size_t b = 0; b < batches; ++b)
{
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/operator/compress/CompressBlosc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ size_t CompressBlosc::Operate(const char *dataIn, const Dims &blockStart,
"ADIOS WARNING: Unknown parameter keyword '" + key +
"' with value '" + value +
"' passed to Blosc compression operator.",
helper::ERROR);
helper::FATALERROR);
}
}

Expand Down
5 changes: 2 additions & 3 deletions source/adios2/toolkit/burstbuffer/FileDrainerSingleThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,8 @@ void FileDrainerSingleThread::DrainThread()
catch (std::ios_base::failure &e)
{
helper::Log("BurstBuffer", "FileDrainerSingleThread",
"DrainThread",
"ADIOS THREAD ERROR: " + std::string(e.what()),
helper::LogMode::ERROR);
"DrainThread", std::string(e.what()),
helper::FATALERROR);
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/query/JsonWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void JsonWorker::ParseJson()
{
helper::Log("Query", "JsonWorker", "ParseJson",
"No such variable: " + varName.dump(),
helper::LogMode::ERROR);
helper::FATALERROR);
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/query/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ bool QueryVar::IsSelectionValid(adios2::Dims &shape) const
helper::Log(
"Query", "QueryVar", "IsSelectionValid",
"Query selection dimension is different from shape dimension",
helper::LogMode::ERROR);
helper::FATALERROR);
return false; // different dimension
}

Expand Down
3 changes: 1 addition & 2 deletions source/adios2/toolkit/query/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ QueryVar *Worker::GetBasicVarQuery(adios2::core::IO &currentIO,
if (varType == DataType::None)
{
helper::Log("Query", "Worker", "GetBasicVarQuery",
"No such variable: " + variableName,
helper::LogMode::ERROR);
"No such variable: " + variableName, helper::FATALERROR);
return nullptr;
}
#define declare_type(T) \
Expand Down
3 changes: 1 addition & 2 deletions source/adios2/toolkit/query/XmlWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ QueryVar *XmlWorker::ParseVarNode(const pugi::xml_node &node,
if (varType == DataType::None)
{
helper::Log("Query", "XmlWorker", "ParseVarNode",
"No such variable: " + variableName,
helper::LogMode::ERROR);
"No such variable: " + variableName, helper::FATALERROR);
helper::Throw<std::ios_base::failure>(
"Toolkit", "query::XmlWorker", "ParseVarNode",
"variable: " + variableName + " not found");
Expand Down
6 changes: 3 additions & 3 deletions source/utils/adios_reorganize/Reorganize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
"write buffer size needs to hold about " +
std::to_string(bufsize) + " bytes but max is set to " +
std::to_string(max_write_buffer_size),
m_Rank, m_Rank, 0, 0, helper::LogMode::ERROR);
m_Rank, m_Rank, 0, 0, helper::FATALERROR);
return 1;
}

Expand All @@ -608,7 +608,7 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
std::to_string(largest_block) +
" bytes but max is set to " +
std::to_string(max_read_buffer_size),
m_Rank, m_Rank, 0, 0, helper::LogMode::ERROR);
m_Rank, m_Rank, 0, 0, helper::FATALERROR);
return 1;
}
return retval;
Expand All @@ -628,7 +628,7 @@ int Reorganize::ReadWrite(core::Engine &rStream, core::Engine &wStream,
std::to_string(nvars) +
") to read does not match the number of processed variables (" +
std::to_string(varinfo.size()) + ")",
m_Rank, m_Rank, 0, 0, helper::LogMode::ERROR);
m_Rank, m_Rank, 0, 0, helper::FATALERROR);
}

/*
Expand Down

0 comments on commit d0a0241

Please sign in to comment.