<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div class="post-text" itemprop="text">
<p>I have old C code and would like to reformat it with clang-format. One problem im facing is, many of old functions are written with K&R parameter initializer lists. And clang-format does a strange reformatting on these lines.</p>

<p>For example following original code:</p>
</div>
</div>

<div class="signature">
<pre><code>int tz_start_new( nr, start, old )
char    *nr;
char    *start;
char    *old;
{
return 0;
}</code></pre>

<div> </div>

<div>gets formatted to:</div>

<div> </div>

<div>
<pre><code>int tz_start_new( nr, start, old ) char *nr;
char    *start;
char    *old;
{
    return 0;
}</code></pre>

<p>So the first parameter is written directly behind the function declaration. The others tays as they were before.</p>

<p>This is the format file i'm using:</p>

<pre><code>---
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: None
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: true
  BeforeCatch: true
  BeforeElse: true
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeTernaryOperators: 'false'
IndentCaseLabels: 'true'
ColumnLimit: '80'
IndentWidth: '4'
Language: Cpp
PointerAlignment: Right
SortIncludes: 'false'
SpaceAfterCStyleCast: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: Never
SpaceInEmptyParentheses: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInParentheses: 'true'
SpacesInSquareBrackets: 'true'
TabWidth: '4'
UseTab: ForIndentation

...
</code></pre>

<div> </div>

<div> </div>

<div>Is there an possibility to support K&R parameter lists and format them the 'right' way or leave they untouched?</div>

<div> </div>

<div> </div>

<div> </div>

<div>Marco</div>
</div>
</div></div></body></html>