This ensures that the exception is only thrown following the destruction
of all other data members.
Change-Id: Ice35cc81130a056c168e7124b0277ec32a9526ce
Signed-off-by: György Straub <g.straub@partner.samsung.com>
setp(buffer, buffer + size);
}
setp(buffer, buffer + size);
}
+ExceptionFlinger::Impl::~Impl() noexcept(false)
+{
+ throw DaliException(mLocation, GetMessageBuffer());
+}
+
ExceptionFlinger::ExceptionFlinger(const char* location) noexcept(true)
ExceptionFlinger::ExceptionFlinger(const char* location) noexcept(true)
mStreamBuffer(GetMessageBuffer(), MESSAGE_BUFFER_SIZE - 1),
mStream(&mStreamBuffer)
{}
mStreamBuffer(GetMessageBuffer(), MESSAGE_BUFFER_SIZE - 1),
mStream(&mStreamBuffer)
{}
ExceptionFlinger::~ExceptionFlinger() noexcept(false)
{
operator<<('\0');
ExceptionFlinger::~ExceptionFlinger() noexcept(false)
{
operator<<('\0');
- throw DaliException(mLocation, GetMessageBuffer());
}
char* ExceptionFlinger::GetMessageBuffer() noexcept(true)
}
char* ExceptionFlinger::GetMessageBuffer() noexcept(true)
+ struct Impl
+ {
+ const char* mLocation;
+
+ [[noreturn]]
+ ~Impl() noexcept(false);
+ };
+
static char* GetMessageBuffer() noexcept(true);
static char* GetMessageBuffer() noexcept(true);
StreamBuffer mStreamBuffer;
std::ostream mStream;
};
StreamBuffer mStreamBuffer;
std::ostream mStream;
};