I use long block C-style Doxygen comments in my C/C++ code. This is style #4 listed on https://www.doxygen.nl/manual/docblocks.html and looks like this (running out to 80 characters)...
/**************************************************************************//**
* \file
* \date 2017-01-02
* \author Alex Hogen
******************************************************************************/
If I run clang-format on this, it inserts a single space between the two forward slashes, so it looks all goofy like this....
/**************************************************************************/ /**
* \file
* \date 2017-01-02
* \author Alex Hogen
******************************************************************************/
SpacesBeforeTrailingComments
set to 2, so that can't be the problem.CommentPragmas
regex \/\*+\/\/\*+
.CommentPragmas
regex /\*(.+\n.+)+\*/
ReflowComments
to false
... but none of those things have worked.
I understand there are two comments in this block, but I can't find any clang-format parameter addressing block comments on the same line. How can I stop clang-format from inserting this space?
And I don't want to solve this by disabling clang-format for every Doxygen comment block. That seems ridiculous.
Any good suggestions?
In your .clang-format
file:
CommentPragmas: '^\\.+'
This will make it not format comment line that starts with a backslash followed by a word. This works even though there is an asterisk before the doxygen comment because clang-format automatically ignores asterisks and whitespace at the beginning of every comment line.