Commit 2983e639 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

[kstyle] use Q_FALLTHROUGH in breezesplitterproxy

Summary:
Qt has its own macro to tell the compiler that the lack of the break
statement is intentional. One of the advantages of using Q_FALLTHROUGH
is that it explicitly says other developers that the break statement is
missing on purpose. Another advantage is that we can use directives,
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817

Test Plan:
Compiled Breeze with GCC 7 and Clang, no "this statement may fall
through" warnings whatsoever.

Reviewers: #breeze, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11860
parent 7821b478
......@@ -26,6 +26,28 @@
#include <QDebug>
#include <QPainter>
// Q_FALLTHROUGH() for Qt < 5.8
#ifndef Q_FALLTHROUGH
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(fallthrough)
#define Q_FALLTHROUGH() [[fallthrough]]
#elif __has_cpp_attribute(clang::fallthrough)
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
#endif
#endif
#ifndef Q_FALLTHROUGH
#if defined(Q_CC_GNU) && Q_CC_GNU >= 700
#define Q_FALLTHROUGH() __attribute__((fallthrough))
#elif defined(Q_CC_CLANG) && Q_CC_CLANG >= 305
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#else
#define Q_FALLTHROUGH()
#endif
#endif
#endif
namespace Breeze
{
......@@ -269,12 +291,13 @@ namespace Breeze
if( static_cast<QTimerEvent*>( event )->timerId() != _timerId )
{ return QWidget::event( event ); }
// fall-through
/*
Fall through is intended.
We somehow lost a QEvent::Leave before timeout. We fix it from here
*/
Q_FALLTHROUGH();
case QEvent::HoverLeave:
case QEvent::Leave:
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment