indent(1): don't add unneeded space to function pointer declarations
If the current token is an opening parenthesis, it's either a function call (or sizeof or offsetof) or a declaration. The former doesn't need a space before the parenthesis.
This commit is contained in:
parent
0a15ff37d6
commit
b06c2eb7b1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334480
@ -542,15 +542,6 @@ main(int argc, char **argv)
|
||||
nitems(ps.paren_indents));
|
||||
ps.p_l_follow--;
|
||||
}
|
||||
if (ps.want_blank && *token != '[' &&
|
||||
((ps.last_token != ident && ps.last_token != funcname) ||
|
||||
proc_calls_space ||
|
||||
/* offsetof (1) is never allowed a space; sizeof (2) gets
|
||||
* one iff -bs; all other keywords (>2) always get a space
|
||||
* before lparen */
|
||||
ps.keyword + Bill_Shannon > 2))
|
||||
*e_code++ = ' ';
|
||||
ps.want_blank = false;
|
||||
if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent &&
|
||||
!is_procname && ps.paren_level == 0) {
|
||||
/* function pointer declarations */
|
||||
@ -563,6 +554,14 @@ main(int argc, char **argv)
|
||||
}
|
||||
ps.dumped_decl_indent = true;
|
||||
}
|
||||
else if (ps.want_blank && *token != '[' &&
|
||||
((ps.last_token != ident && ps.last_token != funcname) ||
|
||||
/* offsetof (1) is never allowed a space; sizeof (2) gets
|
||||
* one iff -bs; all other keywords (>2) always get a space
|
||||
* before lparen */
|
||||
ps.keyword + Bill_Shannon > 2))
|
||||
*e_code++ = ' ';
|
||||
ps.want_blank = false;
|
||||
if (!troff)
|
||||
*e_code++ = token[0];
|
||||
ps.paren_indents[ps.p_l_follow - 1] = count_spaces_until(1, s_code, e_code) - 1;
|
||||
|
@ -32,7 +32,7 @@ t2(char *x, int y)
|
||||
int a, b, c;
|
||||
int
|
||||
*d, *e, *f;
|
||||
int (*g) (), (*h) (), (*i) ();
|
||||
int (*g) (), (*h) (), (*i) ();
|
||||
int j, k, l;
|
||||
int m
|
||||
,n
|
||||
|
Loading…
Reference in New Issue
Block a user