From 9f888d2fde9c5413e5519e0914e9b13638760985 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 27 Jun 2016 15:43:33 +0200 Subject: Support C++17 fallthrough attribute Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira --- src/network/access/qftp.cpp | 2 +- src/network/access/qhttpnetworkconnectionchannel.cpp | 3 ++- src/network/access/qhttpprotocolhandler.cpp | 7 ++++--- src/network/access/qnetworkcookie.cpp | 2 +- src/network/kernel/qhostaddress.cpp | 2 +- src/network/socket/qnativesocketengine_win.cpp | 2 +- src/network/socket/qsocks5socketengine.cpp | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/network') diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 7b6f830333..52b9dd9169 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1121,7 +1121,7 @@ bool QFtpPI::processReply() case Success: // success handling state = Idle; - // no break! + Q_FALLTHROUGH(); case Idle: if (dtp.hasError()) { emit error(QFtp::UnknownError, dtp.errorMessage()); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 3a780f636b..87f88aad5f 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1036,7 +1036,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted() if (!protocolHandler) { switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) { - case QSslConfiguration::NextProtocolNegotiationNegotiated: /* fall through */ + case QSslConfiguration::NextProtocolNegotiationNegotiated: case QSslConfiguration::NextProtocolNegotiationUnsupported: { QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol(); if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) { @@ -1056,6 +1056,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted() "detected unknown Next Protocol Negotiation protocol"); break; } + Q_FALLTHROUGH(); } case QSslConfiguration::NextProtocolNegotiationNone: protocolHandler.reset(new QHttpProtocolHandler(this)); diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp index b486b75449..37e8b9bed8 100644 --- a/src/network/access/qhttpprotocolhandler.cpp +++ b/src/network/access/qhttpprotocolhandler.cpp @@ -99,7 +99,7 @@ void QHttpProtocolHandler::_q_receiveReply() switch (state) { case QHttpNetworkReplyPrivate::NothingDoneState: { m_reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; - // fallthrough + Q_FALLTHROUGH(); } case QHttpNetworkReplyPrivate::ReadingStatusState: { qint64 statusBytes = m_reply->d_func()->readStatus(m_socket); @@ -213,7 +213,8 @@ void QHttpProtocolHandler::_q_receiveReply() if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) break; - // everything done, fall through + // everything done + Q_FALLTHROUGH(); } case QHttpNetworkReplyPrivate::AllDoneState: m_channel->allDone(); @@ -428,7 +429,7 @@ bool QHttpProtocolHandler::sendRequest() } case QHttpNetworkConnectionChannel::ReadingState: // ignore _q_bytesWritten in these states - // fall through + Q_FALLTHROUGH(); default: break; } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 7a538cbf08..b7cf989477 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -644,7 +644,7 @@ static QDateTime parseDateString(const QByteArray &dateString) switch (end - 1) { case 4: minutes = atoi(dateString.mid(at + 3, 2).constData()); - // fall through + Q_FALLTHROUGH(); case 2: hours = atoi(dateString.mid(at + 1, 2).constData()); break; diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 95f90af49e..7e3d2c5d6e 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -536,7 +536,7 @@ QHostAddress::QHostAddress(SpecialAddress address) case LocalHostIPv6: ip6[15] = 1; - // fall through + Q_FALLTHROUGH(); case AnyIPv6: d->setAddress(ip6); return; diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 9ae2d8ba8f..5a9641a9fe 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -712,7 +712,7 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin if (errorDetected) break; - // fall through + Q_FALLTHROUGH(); } case WSAEINPROGRESS: setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString); diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 518ec21f90..a1a8e4649d 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -618,7 +618,7 @@ void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, const QString QSocks5SocketEngine::tr("Connection to proxy timed out")); break; } - /* fall through */ + Q_FALLTHROUGH(); default: q->setError(controlSocketError, data->controlSocket->errorString()); break; @@ -1205,7 +1205,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification() break; } - // fall through + Q_FALLTHROUGH(); default: qWarning("QSocks5SocketEnginePrivate::_q_controlSocketReadNotification: " "Unexpectedly received data while in state=%d and mode=%d", -- cgit v1.2.3