mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Remove workarounds for fixed bugs
This commit is contained in:
@@ -9,6 +9,7 @@ gcc:QMAKE_CXXFLAGS_USE_PRECOMPILE = -Winvalid-pch $$QMAKE_CXXFLAGS_USE_PRECOMPIL
|
|||||||
gcc|llvm:QMAKE_CXXFLAGS_WARN_ON *= -Wzero-as-null-pointer-constant
|
gcc|llvm:QMAKE_CXXFLAGS_WARN_ON *= -Wzero-as-null-pointer-constant
|
||||||
gcc:QMAKE_CXXFLAGS_WARN_ON += -isystem $$[QT_INSTALL_HEADERS]/QtCore
|
gcc:QMAKE_CXXFLAGS_WARN_ON += -isystem $$[QT_INSTALL_HEADERS]/QtCore
|
||||||
llvm:QMAKE_CXXFLAGS_WARN_ON *= -Wno-system-headers
|
llvm:QMAKE_CXXFLAGS_WARN_ON *= -Wno-system-headers
|
||||||
|
gcc:!clang:QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override
|
||||||
|
|
||||||
# elevated warnings
|
# elevated warnings
|
||||||
swiftConfig(allowNoisyWarnings) {
|
swiftConfig(allowNoisyWarnings) {
|
||||||
@@ -32,19 +33,6 @@ else {
|
|||||||
DEFINES *= QT_NO_DEPRECATED_WARNINGS
|
DEFINES *= QT_NO_DEPRECATED_WARNINGS
|
||||||
}
|
}
|
||||||
|
|
||||||
# gcc 5 can warn about missing override keyword,
|
|
||||||
# gcc 6 can do it without thousands of warnings in qt headers
|
|
||||||
gcc: !clang {
|
|
||||||
GCC_VERSION = $$system($$QMAKE_CXX -dumpversion)
|
|
||||||
GCC_MAJOR = $$section(GCC_VERSION, ., 0, 0)
|
|
||||||
greaterThan(GCC_MAJOR, 5) {
|
|
||||||
QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override
|
|
||||||
}
|
|
||||||
greaterThan(GCC_MAJOR, 4):swiftConfig(allowNoisyWarnings) {
|
|
||||||
QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# clazy - Qt-aware linter
|
# clazy - Qt-aware linter
|
||||||
equals(QMAKE_CXX, clazy)|equals(QMAKE_CXX, clazy-cl) {
|
equals(QMAKE_CXX, clazy)|equals(QMAKE_CXX, clazy-cl) {
|
||||||
CLAZY_WARNINGS *= level3 no-reserve-candidates qrequiredresult-candidates
|
CLAZY_WARNINGS *= level3 no-reserve-candidates qrequiredresult-candidates
|
||||||
|
|||||||
@@ -1665,11 +1665,10 @@ namespace BlackCore
|
|||||||
this->insertLatestOffsetTime(callsign, diff);
|
this->insertLatestOffsetTime(callsign, diff);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
static const qint64 minOffsetTime = CFsdSetup::c_interimPositionTimeOffsetMsec; // no longer needed with C++17
|
|
||||||
const qint64 avgTimeMs = this->averageOffsetTimeMs(callsign, count, 3); // latest average
|
const qint64 avgTimeMs = this->averageOffsetTimeMs(callsign, count, 3); // latest average
|
||||||
qint64 offsetTime = CFsdSetup::c_positionTimeOffsetMsec;
|
qint64 offsetTime = CFsdSetup::c_positionTimeOffsetMsec;
|
||||||
|
|
||||||
if (avgTimeMs < minOffsetTime && count >= 3)
|
if (avgTimeMs < CFsdSetup::c_interimPositionTimeOffsetMsec && count >= 3)
|
||||||
{
|
{
|
||||||
offsetTime = CFsdSetup::c_interimPositionTimeOffsetMsec;
|
offsetTime = CFsdSetup::c_interimPositionTimeOffsetMsec;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ namespace BlackCore
|
|||||||
QString iid = json["IID"].toString();
|
QString iid = json["IID"].toString();
|
||||||
if (iid == QStringLiteral("org.swift-project.blackcore.weatherdata"))
|
if (iid == QStringLiteral("org.swift-project.blackcore.weatherdata"))
|
||||||
{
|
{
|
||||||
// PluginExtended() instead of {} to silence wrong warning for gcc < 5.X
|
auto it = m_plugins.insert(pluginIdentifier(json), {});
|
||||||
auto it = m_plugins.insert(pluginIdentifier(json), PluginExtended());
|
|
||||||
it->info.convertFromJson(json);
|
it->info.convertFromJson(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,6 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
CDefaultFormatter::CDefaultFormatter(int alignment, bool i18n, const QList<int> &supportedRoles) :
|
|
||||||
m_supportedRoles(supportedRoles), m_alignment(alignment), m_useI18n(i18n)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Qt::ItemFlags CDefaultFormatter::flags(Qt::ItemFlags flags, bool editable) const
|
Qt::ItemFlags CDefaultFormatter::flags(Qt::ItemFlags flags, bool editable) const
|
||||||
{
|
{
|
||||||
return editable ? (flags | Qt::ItemIsEditable) : (flags & ~Qt::ItemIsEditable);
|
return editable ? (flags | Qt::ItemIsEditable) : (flags & ~Qt::ItemIsEditable);
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
//! \fixme Defining this inline causes ICE in Clang on Windows
|
CDefaultFormatter(int alignment = alignDefault(), bool i18n = true, const QList<int> &supportedRoles = { Qt::DisplayRole }) :
|
||||||
CDefaultFormatter(int alignment = alignDefault(), bool i18n = true, const QList<int> &supportedRoles = { Qt::DisplayRole });
|
m_supportedRoles(supportedRoles), m_alignment(alignment), m_useI18n(i18n)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Virtual destructor
|
//! Virtual destructor
|
||||||
virtual ~CDefaultFormatter() {}
|
virtual ~CDefaultFormatter() {}
|
||||||
|
|||||||
@@ -72,12 +72,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CAtomicFile::~CAtomicFile()
|
CAtomicFile::~CAtomicFile()
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201700L
|
if (std::uncaught_exceptions() > 0) { QFile::close(); }
|
||||||
const bool ex = std::uncaught_exceptions() > 0;
|
|
||||||
#else
|
|
||||||
const bool ex = std::uncaught_exception();
|
|
||||||
#endif
|
|
||||||
if (ex) { QFile::close(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAtomicFile::close()
|
void CAtomicFile::close()
|
||||||
|
|||||||
@@ -384,7 +384,6 @@ namespace BlackMisc
|
|||||||
//! If the value is currently being loaded, wait for it to finish loading, and call the notification slot, if any.
|
//! If the value is currently being loaded, wait for it to finish loading, and call the notification slot, if any.
|
||||||
void synchronize()
|
void synchronize()
|
||||||
{
|
{
|
||||||
// does not compile on gcc without "this" -> this->m_page
|
|
||||||
auto *queue = this->m_page->template findChild<Private::CDataPageQueue *>();
|
auto *queue = this->m_page->template findChild<Private::CDataPageQueue *>();
|
||||||
Q_ASSERT(queue);
|
Q_ASSERT(queue);
|
||||||
this->admit();
|
this->admit();
|
||||||
|
|||||||
@@ -16,14 +16,6 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#include <qt_windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//! \private Escape characters not allowed in dbus paths
|
//! \private Escape characters not allowed in dbus paths
|
||||||
QString toDBusPath(const QString &s)
|
QString toDBusPath(const QString &s)
|
||||||
{
|
{
|
||||||
@@ -69,40 +61,9 @@ enum
|
|||||||
UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000")
|
UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000")
|
||||||
};
|
};
|
||||||
|
|
||||||
QByteArray getMachineUniqueIdImpl()
|
|
||||||
{
|
|
||||||
// TODO RR: Remove the workaround branches as soon as the following two changes are published in 5.12.2 (TBC)
|
|
||||||
// https://codereview.qt-project.org/#/c/249256
|
|
||||||
// https://codereview.qt-project.org/#/c/249399
|
|
||||||
|
|
||||||
QByteArray machineUniqueId;
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
char uuid[UuidStringLen];
|
|
||||||
size_t uuidlen = sizeof(uuid);
|
|
||||||
int ret = sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0);
|
|
||||||
if (ret == 0 && uuidlen == sizeof(uuid))
|
|
||||||
{
|
|
||||||
machineUniqueId = QByteArray(uuid, uuidlen - 1);
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
|
||||||
HKEY key = nullptr;
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
wchar_t buffer[UuidStringLen];
|
|
||||||
DWORD size = sizeof(buffer);
|
|
||||||
bool ok = (RegQueryValueEx(key, L"MachineGuid", nullptr, nullptr, reinterpret_cast<LPBYTE>(buffer), &size) == ERROR_SUCCESS);
|
|
||||||
RegCloseKey(key);
|
|
||||||
if (ok) { machineUniqueId = QStringView(buffer, (size - 1) / 2).toLatin1(); }
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
machineUniqueId = QSysInfo::machineUniqueId();
|
|
||||||
#endif
|
|
||||||
return machineUniqueId;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray cachedMachineUniqueId()
|
QByteArray cachedMachineUniqueId()
|
||||||
{
|
{
|
||||||
static const QByteArray machineUniqueId = getMachineUniqueIdImpl();
|
static const QByteArray machineUniqueId = QSysInfo::machineUniqueId();
|
||||||
return machineUniqueId;
|
return machineUniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -298,8 +298,7 @@ namespace BlackMisc
|
|||||||
template <size_t I>
|
template <size_t I>
|
||||||
using index = std::integral_constant<size_t, I>;
|
using index = std::integral_constant<size_t, I>;
|
||||||
|
|
||||||
// Trailing return type needed to work around MSVC "function returning auto can not be used before it has been defined" with /permissive-
|
constexpr static auto members() { return MetaClass::getMemberList(); }
|
||||||
constexpr static auto members() -> decltype(MetaClass::getMemberList()) { return MetaClass::getMemberList(); }
|
|
||||||
};
|
};
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
|
|
||||||
|
|||||||
@@ -39,21 +39,6 @@ namespace BlackMisc
|
|||||||
// Alternative would be to qualify all our invokations of the global qHash as ::qHash.
|
// Alternative would be to qualify all our invokations of the global qHash as ::qHash.
|
||||||
using ::qHash;
|
using ::qHash;
|
||||||
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
//! \cond PRIVATE
|
|
||||||
// Work around MSVC2015 bug affecting generic lambda
|
|
||||||
template <typename T>
|
|
||||||
struct Hasher
|
|
||||||
{
|
|
||||||
template <typename U>
|
|
||||||
void operator()(const U &member) { m_hash ^= qHash(member.in(m_object)); }
|
|
||||||
const T &m_object;
|
|
||||||
uint &m_hash;
|
|
||||||
};
|
|
||||||
//! \endcond
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Mixin
|
namespace Mixin
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
@@ -76,7 +61,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
uint hash = baseHash(static_cast<const TBaseOfT<Derived> *>(&value));
|
uint hash = baseHash(static_cast<const TBaseOfT<Derived> *>(&value));
|
||||||
constexpr auto meta = introspect<Derived>().without(MetaFlags<DisabledForHashing>());
|
constexpr auto meta = introspect<Derived>().without(MetaFlags<DisabledForHashing>());
|
||||||
meta.forEachMember(Private::Hasher<Derived> { value, hash });
|
meta.forEachMember([ & ](const auto &member) { hash ^= qHash(member.in(value)); });
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ namespace BlackMisc
|
|||||||
ConverterFunction m_fromDefault = nullptr; //!< convert to this unit from default unit
|
ConverterFunction m_fromDefault = nullptr; //!< convert to this unit from default unit
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Workaround to constant-initialize QLatin1String on platforms without constexpr strlen.
|
//! Constant-initialize QLatin1String without using strlen.
|
||||||
template <int N>
|
template <int N>
|
||||||
static constexpr QLatin1String constQLatin1(const char (&str)[N])
|
static constexpr QLatin1String constQLatin1(const char (&str)[N])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -134,8 +134,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set some default values
|
// set some default values
|
||||||
const qint64 defaultValueMs = CFsdSetup::c_interimPositionTimeOffsetMsec; // CLANG cannot use reference in qMax
|
const qint64 os = qMax(CFsdSetup::c_interimPositionTimeOffsetMsec, m_s[2].getTimeOffsetMs());
|
||||||
const qint64 os = qMax(defaultValueMs, m_s[2].getTimeOffsetMs());
|
|
||||||
m_s[0].addMsecs(-os); // oldest, Ref T297 default offset time to fill data
|
m_s[0].addMsecs(-os); // oldest, Ref T297 default offset time to fill data
|
||||||
m_s[2].addMsecs(os); // latest, Ref T297 default offset time to fill data
|
m_s[2].addMsecs(os); // latest, Ref T297 default offset time to fill data
|
||||||
if (m_currentSituations.isEmpty()) { return false; }
|
if (m_currentSituations.isEmpty()) { return false; }
|
||||||
|
|||||||
@@ -61,13 +61,6 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed because these constants are odr-used (just like traditional C++98 static const)
|
|
||||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54483
|
|
||||||
const StatusSeverity CStatusMessage::SeverityDebug;
|
|
||||||
const StatusSeverity CStatusMessage::SeverityInfo;
|
|
||||||
const StatusSeverity CStatusMessage::SeverityWarning;
|
|
||||||
const StatusSeverity CStatusMessage::SeverityError;
|
|
||||||
|
|
||||||
CStatusMessage::CStatusMessage(const CLogCategory &category) :
|
CStatusMessage::CStatusMessage(const CLogCategory &category) :
|
||||||
CMessageBase(category), ITimestampBased(QDateTime::currentMSecsSinceEpoch())
|
CMessageBase(category), ITimestampBased(QDateTime::currentMSecsSinceEpoch())
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -72,10 +72,6 @@ namespace BlackMisc
|
|||||||
// CValueCachePacket
|
// CValueCachePacket
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
CValueCachePacket::CValueCachePacket(bool saved, bool valuesChanged) :
|
|
||||||
m_saved(saved), m_valuesChanged(valuesChanged)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CValueCachePacket::CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved, bool valuesChanged) :
|
CValueCachePacket::CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved, bool valuesChanged) :
|
||||||
m_saved(saved), m_valuesChanged(valuesChanged)
|
m_saved(saved), m_valuesChanged(valuesChanged)
|
||||||
{
|
{
|
||||||
@@ -570,12 +566,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (m_page)
|
if (m_page)
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201700L
|
if (std::uncaught_exceptions() > 0) { m_page->abandonBatch(); }
|
||||||
const bool ex = std::uncaught_exceptions() > 0;
|
|
||||||
#else
|
|
||||||
const bool ex = std::uncaught_exception();
|
|
||||||
#endif
|
|
||||||
if (ex) { m_page->abandonBatch(); }
|
|
||||||
else { m_page->endBatch(); }
|
else { m_page->endBatch(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ namespace BlackMisc
|
|||||||
using base_type = CDictionary;
|
using base_type = CDictionary;
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
//! \fixme Defining this inline causes ICE in Clang on Windows
|
CValueCachePacket(bool saved = false, bool valuesChanged = true) :
|
||||||
CValueCachePacket(bool saved = false, bool valuesChanged = true);
|
m_saved(saved), m_valuesChanged(valuesChanged)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Construct from CVariantMap and a timestamp.
|
//! Construct from CVariantMap and a timestamp.
|
||||||
CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved = false, bool valuesChanged = true);
|
CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved = false, bool valuesChanged = true);
|
||||||
|
|||||||
Reference in New Issue
Block a user