Make Q_FALLTHROUGH code compile with Qt < 5.8

sorry for breaking FreeBSD CI build. I didn't expect Q_FALLTHROUGH being
newer.
This commit is contained in:
Martin Flöser 2017-07-27 21:51:47 +02:00
parent a13ecb1cac
commit eee2ace6a1
3 changed files with 14 additions and 0 deletions

View file

@ -281,7 +281,9 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool
drawObject(p, HorizontalLine, r.x()+(r.width()-lwMark)/2, r.y()+(r.height()-lwMark)/2, lwMark, lwMark); drawObject(p, HorizontalLine, r.x()+(r.width()-lwMark)/2, r.y()+(r.height()-lwMark)/2, lwMark, lwMark);
// Fall through to OnAllDesktopsIcon intended! // Fall through to OnAllDesktopsIcon intended!
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
} }
case OnAllDesktopsIcon: case OnAllDesktopsIcon:
{ {
@ -307,7 +309,9 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool
drawObject(p, HorizontalLine, center-(lwArrow-2), r.y()+2*lwArrow, (lwArrow-2)*2, lwArrow); drawObject(p, HorizontalLine, center-(lwArrow-2), r.y()+2*lwArrow, (lwArrow-2)*2, lwArrow);
// Fall through to KeepAboveIcon intended! // Fall through to KeepAboveIcon intended!
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
} }
case KeepAboveIcon: case KeepAboveIcon:
{ {
@ -333,7 +337,9 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool
drawObject(p, HorizontalLine, center-(lwArrow-2), r.bottom()-(lwArrow-1)-2*lwArrow, (lwArrow-2)*2, lwArrow); drawObject(p, HorizontalLine, center-(lwArrow-2), r.bottom()-(lwArrow-1)-2*lwArrow, (lwArrow-2)*2, lwArrow);
// Fall through to KeepBelowIcon intended! // Fall through to KeepBelowIcon intended!
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
} }
case KeepBelowIcon: case KeepBelowIcon:
{ {

View file

@ -97,7 +97,9 @@ OpenGLBackend *X11StandalonePlatform::createOpenGLBackend()
} else { } else {
qCWarning(KWIN_X11STANDALONE) << "Glx not available, trying EGL instead."; qCWarning(KWIN_X11STANDALONE) << "Glx not available, trying EGL instead.";
// no break, needs fall-through // no break, needs fall-through
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
} }
#endif #endif
case EglPlatformInterface: case EglPlatformInterface:
@ -212,7 +214,9 @@ void X11StandalonePlatform::createOpenGLSafePoint(OpenGLSafePoint safePoint)
group.writeEntry(unsafeKey, true); group.writeEntry(unsafeKey, true);
group.sync(); group.sync();
// Deliberately continue with PreFrame // Deliberately continue with PreFrame
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
case OpenGLSafePoint::PreFrame: case OpenGLSafePoint::PreFrame:
if (m_openGLFreezeProtectionThread == nullptr) { if (m_openGLFreezeProtectionThread == nullptr) {
Q_ASSERT(m_openGLFreezeProtection == nullptr); Q_ASSERT(m_openGLFreezeProtection == nullptr);
@ -241,7 +245,9 @@ void X11StandalonePlatform::createOpenGLSafePoint(OpenGLSafePoint safePoint)
group.writeEntry(unsafeKey, false); group.writeEntry(unsafeKey, false);
group.sync(); group.sync();
// Deliberately continue with PostFrame // Deliberately continue with PostFrame
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
case OpenGLSafePoint::PostFrame: case OpenGLSafePoint::PostFrame:
QMetaObject::invokeMethod(m_openGLFreezeProtection, "stop", Qt::QueuedConnection); QMetaObject::invokeMethod(m_openGLFreezeProtection, "stop", Qt::QueuedConnection);
break; break;

View file

@ -525,7 +525,9 @@ void SceneOpenGL::initDebugOutput()
if (strstr(message, "Buffer detailed info:") && strstr(message, "has been updated")) if (strstr(message, "Buffer detailed info:") && strstr(message, "has been updated"))
scheduleVboReInit(); scheduleVboReInit();
// fall through! for general message printing // fall through! for general message printing
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
case GL_DEBUG_TYPE_PORTABILITY: case GL_DEBUG_TYPE_PORTABILITY:
case GL_DEBUG_TYPE_PERFORMANCE: case GL_DEBUG_TYPE_PERFORMANCE: