mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Fix GCC7 fallthrough warnings
This commit is contained in:
committed by
Klaus Basan
parent
c0d9aacbb1
commit
ebe23a694b
@@ -7,6 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/fallthrough.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/aviation/aircraftsituation.h"
|
||||
#include "blackmisc/aviation/aircraftsituationchange.h"
|
||||
@@ -393,6 +394,7 @@ namespace BlackMisc
|
||||
const int c = Compare::compare(this->getGroundElevationInfo(), compareValue.getGroundElevationInfo());
|
||||
if (c != 0) { return c; }
|
||||
// fall through, compare flag
|
||||
BLACK_FALLTHROUGH;
|
||||
}
|
||||
case IndexGroundElevationInfoTransferred: return Compare::compare(m_isElvInfoTransferred, compareValue.m_isElvInfoTransferred);
|
||||
case IndexCanLikelySkipNearGroundInterpolation: return Compare::compare(this->canLikelySkipNearGroundInterpolation(), compareValue.canLikelySkipNearGroundInterpolation());
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexArtifactsPilotClient: return CVariant::fromValue(m_artifactsPilotClient);
|
||||
case IndexArtifactsXSwiftBus: CVariant::fromValue(m_artifactsXSwiftBus);
|
||||
case IndexArtifactsXSwiftBus: return CVariant::fromValue(m_artifactsXSwiftBus);
|
||||
case IndexDistributions: return CVariant::fromValue(m_distributions);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
|
||||
33
src/blackmisc/fallthrough.h
Normal file
33
src/blackmisc/fallthrough.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_FALLTHROUGH_H
|
||||
#define BLACKMISC_FALLTHROUGH_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
//! \cond
|
||||
|
||||
// MSVC2017: [[fallthrough]] supported but only enabled with /std:c++17
|
||||
// GCC7+: [[gnu::fallthrough]] for C++11/14, [[fallthrough]] for C++17
|
||||
// XCode: Does not seem to work in current configuration
|
||||
|
||||
#if defined(Q_CC_GNU) && Q_CC_GNU > 700
|
||||
#if __has_cpp_attribute(fallthrough)
|
||||
#define BLACK_FALLTHROUGH [[gnu::fallthrough]]
|
||||
#endif
|
||||
#else
|
||||
#define BLACK_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif
|
||||
@@ -7,6 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/fallthrough.h"
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include "blackmisc/logpattern.h"
|
||||
@@ -155,8 +156,11 @@ namespace BlackMisc
|
||||
// there are deliberately no break statements in this switch block
|
||||
default:
|
||||
case CStatusMessage::SeverityDebug: result.m_severities.insert(CStatusMessage::SeverityDebug);
|
||||
BLACK_FALLTHROUGH;
|
||||
case CStatusMessage::SeverityInfo: result.m_severities.insert(CStatusMessage::SeverityInfo);
|
||||
BLACK_FALLTHROUGH;
|
||||
case CStatusMessage::SeverityWarning: result.m_severities.insert(CStatusMessage::SeverityWarning);
|
||||
BLACK_FALLTHROUGH;
|
||||
case CStatusMessage::SeverityError: result.m_severities.insert(CStatusMessage::SeverityError);
|
||||
}
|
||||
return result;
|
||||
@@ -273,6 +277,7 @@ namespace BlackMisc
|
||||
case EndsWith: return std::all_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.endsWith(other.getSuffix()); });
|
||||
case Contains: return std::all_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.contains(other.getSubstring()); });
|
||||
default: ;
|
||||
BLACK_FALLTHROUGH ;
|
||||
}
|
||||
case AllOf:
|
||||
switch (other.m_strategy)
|
||||
@@ -284,6 +289,7 @@ namespace BlackMisc
|
||||
case EndsWith: return std::any_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.endsWith(other.getSuffix()); });
|
||||
case Contains: return std::any_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.contains(other.getSubstring()); });
|
||||
default: ;
|
||||
BLACK_FALLTHROUGH ;
|
||||
}
|
||||
case StartsWith:
|
||||
switch (other.m_strategy)
|
||||
|
||||
@@ -113,8 +113,8 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexName: this->setName(variant.value<QString>()); break;
|
||||
case IndexDescription: this->setDescription(variant.value<QString>()); break;
|
||||
case IndexUrl: m_url.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
case IndexSize: this->setSize(variant.toInt());
|
||||
case IndexUrl: m_url.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexSize: this->setSize(variant.toInt()); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user