D24568: Provide clang-format target with a KDE Frameworks style file

Christoph Cullmann noreply at phabricator.kde.org
Wed Oct 16 22:21:24 BST 2019


cullmann added a comment.


  In D24568#548490 <https://phabricator.kde.org/D24568#548490>, @dfaure wrote:
  
  > Do we want these, found in https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format?
  >
  >   # We use template< without space.
  >   SpaceAfterTemplateKeyword: false
  >  
  >   # macros for which the opening brace stays attached.
  >   ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
  >  
  >   # Break constructor initializers before the colon and after the commas.
  >   BreakConstructorInitializers: BeforeColon
  >
  
  
  added that
  
  > In general, I'm curious why we're not using qt5's clang-format file, with our only difference (braces for single-line statements) on top?
  
  I was more comfortable tweaking the file I created some years ago (and updated for all clang-format versions since then) that should be close to the kdelibs style than trying to take a look in detail at the other one, to be honest ;=)

INLINE COMMENTS

> dfaure wrote in KDEClangFormat.cmake:76
> I wonder if people compiling KF5 modules (and not necessarily planning on contributing) need to be annoyed with such a warning. Maybe we could still define the clang-format target and make it print an error?

Yeah, I think some message on running the target will be less annoying.

> dfaure wrote in clang-format.cmake:43
> I'm confused because here it says "true" will group via empty lines, while https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format says `the SortInclude feature of clang-format does not re-order includes separated by empty lines`. Maybe different versions of clang-format? Or I misunderstand something?

Perhaps my comment is not understandable.
true means clang-format will sort stuff inside #include groups (aka #include lines without empty lines in-between)
Will alter the comment.

> dfaure wrote in clang-format.cmake:49
> https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format says `PointerBindsToType: false`, what's the difference?

My file is for some recent clang, whereas PointerBindsToType seems to be ancient, see:

https://releases.llvm.org/3.4/tools/clang/docs/ClangFormatStyleOptions.html (there you still have that)

http://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormatStyleOptions.html (here I can only find the variant I use)

REPOSITORY
  R240 Extra CMake Modules

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

To: cullmann, #frameworks, dfaure
Cc: mwolff, ochurlaud, nalvarez, kossebau, aacid, davidedmundson, dhaumann, apol, ognarb, kde-frameworks-devel, kde-buildsystem, LeGast00n, GB_2, bencreasy, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191016/58a5bd79/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list