Fixed misformatting of "struct foo *bar" in function parameter lists. It

was mangled to "struct foo * bar".  There should be an option to control
this, but no space is normal.  This finishes fixing the bugs in rev.1.4.

indent(1) still doesn't really understand types in parameter lists.  It
thinks keywords inside parentheses are for casts or sizeofs.  This works
accidentally for scalar types and this quick fix makes it work similarly
but not so accidentally for struct/union/enum types.
This commit is contained in:
Bruce Evans 2004-02-09 15:27:02 +00:00
parent 78d6d797e9
commit 47fe027b66
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125623

View File

@ -234,14 +234,18 @@ lexi(void)
}
ps.its_a_keyword = false;
ps.sizeof_keyword = false;
if (l_struct) { /* if last token was 'struct', then this token
if (l_struct && !ps.p_l_follow) {
/* if last token was 'struct' and we're not
* in parentheses, then this token
* should be treated as a declaration */
l_struct = false;
last_code = ident;
ps.last_u_d = true;
return (decl);
}
ps.last_u_d = false; /* Operator after identifier is binary */
ps.last_u_d = l_struct; /* Operator after identifier is binary
* unless last token was 'struct' */
l_struct = false;
last_code = ident; /* Remember that this is the code we will
* return */
@ -273,18 +277,17 @@ lexi(void)
return (casestmt);
case 3: /* a "struct" */
if (ps.p_l_follow)
break; /* inside parens: cast */
l_struct = true;
/*
* Next time around, we will want to know that we have had a
* 'struct'
*/
l_struct = true;
/* FALLTHROUGH */
case 4: /* one of the declaration keywords */
if (ps.p_l_follow) {
ps.cast_mask |= 1 << ps.p_l_follow;
break; /* inside parens: cast */
ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.sizeof_mask;
break; /* inside parens: cast, param list or sizeof */
}
last_code = decl;
return (decl);