Commit c2a9cb7a authored by Martin Marinov's avatar Martin Marinov

Bug fix to CodeLink output where in the function name was streamed before the...

Bug fix to CodeLink output where in the function name was streamed before the rest of the intended output in the Debug system.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 14229]
parent a38d143d
......@@ -737,13 +737,14 @@ Stream& global_stream()
void warning(const std::string& _wrng, const Base::CodeLink& _lnk)
{
TEST_only(Test::Checksum::Debug::warning.record(_wrng, _lnk));
global_stream() << WARNING << ": " << _wrng << _lnk << Base::LF;
global_stream() << WARNING << ": " << _wrng << ' ' << _lnk << Base::LF;
}
void error(const std::string& _err, const Base::CodeLink& _lnk)
{
TEST_only(Test::Checksum::Debug::error.record(_err, _lnk));
global_stream() << ERROR << ": " << _err << _lnk << Base::Command::END_ERR;
global_stream() << ERROR << ": " << _err << ' ' << _lnk <<
Base::Command::END_ERR;
}
//////////////////////////////////////////////////////////////////////////
......
......@@ -74,16 +74,23 @@ IOutputStream& operator<<(IOutputStream& _os, const boost::filesystem::path& _pa
return _os << '\"' << _path.string().c_str() << '\"';
}
IOutputStream& filter_function_name(IOutputStream& _os, const char* _fnct)
// Represent this as an object in the stream, to preserve the streaming order
struct FunctionNameFilter
{
FunctionNameFilter(const char* _fnct) : fnct_(_fnct) {}
const char* fnct_;
};
IOutputStream& operator<<(IOutputStream& _os, const FunctionNameFilter& _fnf)
{
// The goal is to filter unstable text from the function name, e.g., lambdas.
// MSVC Lambda function name: <lambda_136f4d101172d40b57aea5f0078ce711>
// Multiple lambdas could be in the same function?
// TODO: this naming pattern is compiler/platform dependent
// gcc lambda name is <lambdaX>
const char lmbd[] = "<lambda";
const char* fnct = _fnct;
const char* fnct = _fnf.fnct_;
for(;;)
{
const char* lmbd_pos = strstr(fnct, lmbd);
......@@ -103,11 +110,6 @@ IOutputStream& filter_function_name(IOutputStream& _os, const char* _fnct)
return _os;
}
IOutputStream& operator<<(IOutputStream& _os, IOutputStream& /*_os*/)
{
return _os;
}
IOutputStream& operator<<(IOutputStream& _os, const CodeLink& _lnk)
{
#ifdef WIN32
......@@ -122,7 +124,7 @@ IOutputStream& operator<<(IOutputStream& _os, const CodeLink& _lnk)
else
++flnm_pntr;
return _os << "@ [" << filter_function_name(_os, _lnk.fnct) << "() in "
return _os << "@ [" << FunctionNameFilter(_lnk.fnct) << "() in "
<< flnm_pntr << ":" << _lnk.line << "]";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment