mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 03:35:38 +08:00
Fix GCC7 fallthrough warnings
This commit is contained in:
committed by
Klaus Basan
parent
c0d9aacbb1
commit
ebe23a694b
@@ -10,6 +10,7 @@
|
|||||||
#include "blackcore/aircraftmatcher.h"
|
#include "blackcore/aircraftmatcher.h"
|
||||||
#include "blackcore/application.h"
|
#include "blackcore/application.h"
|
||||||
#include "blackcore/webdataservices.h"
|
#include "blackcore/webdataservices.h"
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/simulation/matchingutils.h"
|
#include "blackmisc/simulation/matchingutils.h"
|
||||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||||
@@ -226,7 +227,7 @@ namespace BlackCore
|
|||||||
matchedModel = candidates.minOrderOrDefault();
|
matchedModel = candidates.minOrderOrDefault();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// [[clang::fallthrough]];
|
BLACK_FALLTHROUGH;
|
||||||
case CAircraftMatcherSetup::PickFirst:
|
case CAircraftMatcherSetup::PickFirst:
|
||||||
default:
|
default:
|
||||||
usedStrategy = CAircraftMatcherSetup::PickFirst; // re-assigned if fall-through
|
usedStrategy = CAircraftMatcherSetup::PickFirst; // re-assigned if fall-through
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "blackgui/shortcut.h"
|
#include "blackgui/shortcut.h"
|
||||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||||
#include "blackmisc/aviation/livery.h"
|
#include "blackmisc/aviation/livery.h"
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/network/authenticateduser.h"
|
#include "blackmisc/network/authenticateduser.h"
|
||||||
@@ -612,6 +613,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
// fall thru intended
|
// fall thru intended
|
||||||
this->formatVPilotView();
|
this->formatVPilotView();
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "blackgui/models/aircraftmodellistmodel.h"
|
#include "blackgui/models/aircraftmodellistmodel.h"
|
||||||
#include "blackgui/models/columnformatters.h"
|
#include "blackgui/models/columnformatters.h"
|
||||||
#include "blackgui/models/columns.h"
|
#include "blackgui/models/columns.h"
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||||
#include "blackmisc/aviation/airlineicaocode.h"
|
#include "blackmisc/aviation/airlineicaocode.h"
|
||||||
#include "blackmisc/aviation/livery.h"
|
#include "blackmisc/aviation/livery.h"
|
||||||
@@ -75,6 +76,7 @@ namespace BlackGui
|
|||||||
case OwnModelSet:
|
case OwnModelSet:
|
||||||
// intentional fall thru
|
// intentional fall thru
|
||||||
m_columns.addColumn(CColumn::orderColumn());
|
m_columns.addColumn(CColumn::orderColumn());
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
|
|
||||||
case OwnAircraftModelMappingTool:
|
case OwnAircraftModelMappingTool:
|
||||||
case StashModel:
|
case StashModel:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackgui/models/columns.h"
|
#include "blackgui/models/columns.h"
|
||||||
#include "blackgui/models/distributorlistmodel.h"
|
#include "blackgui/models/distributorlistmodel.h"
|
||||||
#include "blackmisc/db/datastore.h"
|
#include "blackmisc/db/datastore.h"
|
||||||
@@ -46,6 +47,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
case NormalWithOrder:
|
case NormalWithOrder:
|
||||||
this->m_columns.addColumn(CColumn::orderColumn());
|
this->m_columns.addColumn(CColumn::orderColumn());
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
case NotSet:
|
case NotSet:
|
||||||
case Normal:
|
case Normal:
|
||||||
{
|
{
|
||||||
@@ -64,6 +66,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
case MinimalWithOrder:
|
case MinimalWithOrder:
|
||||||
this->m_columns.addColumn(CColumn::orderColumn());
|
this->m_columns.addColumn(CColumn::orderColumn());
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
case Minimal:
|
case Minimal:
|
||||||
{
|
{
|
||||||
this->m_columns.addColumn(CColumn::standardString("key", CDistributor::IndexDbStringKey));
|
this->m_columns.addColumn(CColumn::standardString("key", CDistributor::IndexDbStringKey));
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackmisc/simulation/aircraftmodel.h"
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituation.h"
|
||||||
#include "blackmisc/aviation/aircraftsituationchange.h"
|
#include "blackmisc/aviation/aircraftsituationchange.h"
|
||||||
@@ -393,6 +394,7 @@ namespace BlackMisc
|
|||||||
const int c = Compare::compare(this->getGroundElevationInfo(), compareValue.getGroundElevationInfo());
|
const int c = Compare::compare(this->getGroundElevationInfo(), compareValue.getGroundElevationInfo());
|
||||||
if (c != 0) { return c; }
|
if (c != 0) { return c; }
|
||||||
// fall through, compare flag
|
// fall through, compare flag
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
case IndexGroundElevationInfoTransferred: return Compare::compare(m_isElvInfoTransferred, compareValue.m_isElvInfoTransferred);
|
case IndexGroundElevationInfoTransferred: return Compare::compare(m_isElvInfoTransferred, compareValue.m_isElvInfoTransferred);
|
||||||
case IndexCanLikelySkipNearGroundInterpolation: return Compare::compare(this->canLikelySkipNearGroundInterpolation(), compareValue.canLikelySkipNearGroundInterpolation());
|
case IndexCanLikelySkipNearGroundInterpolation: return Compare::compare(this->canLikelySkipNearGroundInterpolation(), compareValue.canLikelySkipNearGroundInterpolation());
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace BlackMisc
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexArtifactsPilotClient: return CVariant::fromValue(m_artifactsPilotClient);
|
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);
|
case IndexDistributions: return CVariant::fromValue(m_distributions);
|
||||||
default: return CValueObject::propertyByIndex(index);
|
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.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/fallthrough.h"
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/logpattern.h"
|
#include "blackmisc/logpattern.h"
|
||||||
@@ -155,8 +156,11 @@ namespace BlackMisc
|
|||||||
// there are deliberately no break statements in this switch block
|
// there are deliberately no break statements in this switch block
|
||||||
default:
|
default:
|
||||||
case CStatusMessage::SeverityDebug: result.m_severities.insert(CStatusMessage::SeverityDebug);
|
case CStatusMessage::SeverityDebug: result.m_severities.insert(CStatusMessage::SeverityDebug);
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
case CStatusMessage::SeverityInfo: result.m_severities.insert(CStatusMessage::SeverityInfo);
|
case CStatusMessage::SeverityInfo: result.m_severities.insert(CStatusMessage::SeverityInfo);
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
case CStatusMessage::SeverityWarning: result.m_severities.insert(CStatusMessage::SeverityWarning);
|
case CStatusMessage::SeverityWarning: result.m_severities.insert(CStatusMessage::SeverityWarning);
|
||||||
|
BLACK_FALLTHROUGH;
|
||||||
case CStatusMessage::SeverityError: result.m_severities.insert(CStatusMessage::SeverityError);
|
case CStatusMessage::SeverityError: result.m_severities.insert(CStatusMessage::SeverityError);
|
||||||
}
|
}
|
||||||
return result;
|
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 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()); });
|
case Contains: return std::all_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.contains(other.getSubstring()); });
|
||||||
default: ;
|
default: ;
|
||||||
|
BLACK_FALLTHROUGH ;
|
||||||
}
|
}
|
||||||
case AllOf:
|
case AllOf:
|
||||||
switch (other.m_strategy)
|
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 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()); });
|
case Contains: return std::any_of(m_strings.begin(), m_strings.end(), [ & ](const QString & s) { return s.contains(other.getSubstring()); });
|
||||||
default: ;
|
default: ;
|
||||||
|
BLACK_FALLTHROUGH ;
|
||||||
}
|
}
|
||||||
case StartsWith:
|
case StartsWith:
|
||||||
switch (other.m_strategy)
|
switch (other.m_strategy)
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
case IndexName: this->setName(variant.value<QString>()); break;
|
case IndexName: this->setName(variant.value<QString>()); break;
|
||||||
case IndexDescription: this->setDescription(variant.value<QString>()); break;
|
case IndexDescription: this->setDescription(variant.value<QString>()); break;
|
||||||
case IndexUrl: m_url.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
case IndexUrl: m_url.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexSize: this->setSize(variant.toInt());
|
case IndexSize: this->setSize(variant.toInt()); break;
|
||||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -792,6 +792,7 @@ namespace XSwiftBus
|
|||||||
}
|
}
|
||||||
else { return xpmpData_Unchanged; }
|
else { return xpmpData_Unchanged; }
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case xpmpDataType_Radar:
|
case xpmpDataType_Radar:
|
||||||
if (plane->hasXpdr)
|
if (plane->hasXpdr)
|
||||||
@@ -805,10 +806,8 @@ namespace XSwiftBus
|
|||||||
}
|
}
|
||||||
else { return xpmpData_Unchanged; }
|
else { return xpmpData_Unchanged; }
|
||||||
}
|
}
|
||||||
else { return xpmpData_Unavailable; }
|
|
||||||
|
|
||||||
default: return xpmpData_Unavailable;
|
|
||||||
}
|
}
|
||||||
|
return xpmpData_Unavailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTraffic::orbitPlaneFunc(XPLMCameraPosition_t *cameraPosition, int isLosingControl, void *refcon)
|
int CTraffic::orbitPlaneFunc(XPLMCameraPosition_t *cameraPosition, int isLosingControl, void *refcon)
|
||||||
|
|||||||
Reference in New Issue
Block a user