mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Fixed strict aliasing warning
Summary: Use `noquote` method instead of relying on undefined behaviour. This fixes a warning in GCC 6.3. `noquote` method was added in Qt 5.4. Reviewers: #swift_pilot_client, kbasan Reviewed By: kbasan Subscribers: jenkins Tags: #swift_pilot_client Differential Revision: https://dev.swift-project.org/D26
This commit is contained in:
@@ -30,14 +30,7 @@ namespace BlackMisc
|
||||
|
||||
CLogMessage::~CLogMessage()
|
||||
{
|
||||
// ostream(encodedCategory()) << message(); // QDebug::operator<<(QString) puts quote characters around the message
|
||||
|
||||
// hack to avoid putting quote characters around the message
|
||||
// should be safe, we could directly call qt_message_output instead, but it's undocumented
|
||||
QByteArray category = qtCategory();
|
||||
QDebug debug = ostream(category);
|
||||
auto &stream = **reinterpret_cast<QTextStream **>(&debug); // should be safe because it is relying on Qt's guarantee of ABI compatibility
|
||||
stream << message();
|
||||
ostream(qtCategory()).noquote() << message();
|
||||
}
|
||||
|
||||
QByteArray CLogMessage::qtCategory() const
|
||||
|
||||
Reference in New Issue
Block a user