1

I got this doxygen comments in my legacy codebase and I like to keep them for consistency.

/***************//****************************************************************
 *
 * @file
 *
 * Serial inteface to Novatel OEM4 GPS API.
 *
 *******************************************************************************/

Unfortunately clang-format-7 is formatting the comments unusual and makes the doxygen comments useless.

/*****************************************************************************/ /**
                                                                                 *
                                                                                 * @file
                                                                                 *
                                                                                 * Serial inteface to Novatel OEM4 GPS API.
                                                                                                                                                                *
                                                                                 *******************************************************************************/

I tried CommentPragmas : '^\.+' or '//**' in my .clang-format with no success.

My .clang-format is the following

---
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: None
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Stroustrup
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: 'true'
ColumnLimit: '132'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
IndentCaseLabels: 'false'
IndentPPDirectives: AfterHash
IndentWidth: '4'
IndentWrappedFunctionNames: 'false'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
MaxEmptyLinesToKeep: '1'
PointerAlignment: Right
ReflowComments: 'true'
SortIncludes: 'false'
SortUsingDeclarations: 'false'
SpaceAfterCStyleCast: 'true'
SpacesBeforeTrailingComments: '2'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'false'
SpaceBeforeParens: ControlStatements
Standard: Cpp11
TabWidth: '4'
UseTab: Never
CommentPragmas: '^\\.+'

...

I expect the doxygen comment to be untouched with my CommentPragmas, but it is not working for me.

Any help is appreciated.

eimer
  • 81
  • 7

1 Answers1

0

Changing ReflowComments to false should do the thing (at least with clang-format 8.0).

nVxx
  • 661
  • 7
  • 20
  • This will stop any reflow of comments everywhere. And it will transform the first line to ...***//**. That is not what I want. I tried the CommentPragmaS option, but couldn't figure it out :( – eimer Aug 02 '19 at 18:14