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

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Sun Sep 23 11:35:49 BST 2018


kossebau added a comment.


  In D15694#330222 <https://phabricator.kde.org/D15694#330222>, @aaronpuchert wrote:
  
  > @kossebau It seems you did something similar in D6301 <https://phabricator.kde.org/D6301>, maybe you can review this change. Should I also include `qtcompat_p.h` when `Q_FALLTHROUGH` is used?
  
  
  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)
  
  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.
  
  No idea about the two suspicious places.

INLINE COMMENTS

> CMakeLists.txt:126
>  add_compile_flag_if_supported(-Werror=tautological-undefined-compare)
> +add_compile_flag_if_supported(-Werror=implicit-fallthrough)    # Use Q_FALLTHROUGH for false positives.
>  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")

On GCC this flag is already enabled by -Wextra, which by something is already set for me.
What about other compilers?

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/0d0d1eec/attachment.html>


More information about the KDevelop-devel mailing list