clang-format打破长的doxygen注释

时间:2019-03-23 20:30:50

标签: comments doxygen clang-format

我在旧版代码库中得到了这种doxygen注释,我希望保持它们的一致性。

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

不幸的是,clang-format-7格式化了注释异常,并使doxygen注释无用。

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

我尝试使用.clang格式的CommentPragmas:'^ \。+'或'// **' 没有成功。

我的.clang格式如下

---
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: '^\\.+'

...

我希望我的CommentPragmas不会影响doxygen注释,但是它对我不起作用。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

ReflowComments更改为false应该可以(至少使用clang-format 8.0)。