D15694: Make implicit fallthroughs a compiler error, remove unneeded breaks

Aaron Puchert noreply at phabricator.kde.org
Sun Sep 23 15:24:04 BST 2018


aaronpuchert added a comment.


  In D15694#330503 <https://phabricator.kde.org/D15694#330503>, @kossebau wrote:
  
  > Yes, needs to be included for such source file, because the min Qt dependency version is still 5.5, and Q_FALLTHROUGH was only introduced in 5.8 (see note at http://doc.qt.io/qt-5/qtglobal.html#Q_FALLTHROUGH)
  
  
  I suspected that. I saw your change only after I pushed this, I will add the includes.
  
  > Myself I never got really friends with the C++ switch statement, so have no personal style to defend here, fine to follow mainstream (as in, what compilers nudge us into :) ). So no objections to this patch.
  
  Switch statements are definitely weird <https://en.wikipedia.org/wiki/Duff%27s_device>, so I guess these warnings can be understood as enforcing a stricter (and more sensible) syntax.

INLINE COMMENTS

> kossebau wrote in CMakeLists.txt:126
> On GCC this flag is already enabled by -Wextra, which by something is already set for me.
> What about other compilers?

I didn't see it with Clang. Clang doesn't support fallthrough comments like GCC <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html> does, and the standard `[[fallthrough]]` attribute is only available with C++17, maybe that's why it's not on by default.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D15694

To: aaronpuchert, #kdevelop
Cc: kossebau, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180923/620e6b94/attachment.html>


More information about the KDevelop-devel mailing list