indent(1): restore working -pcs

My previous indent(1) commit accidentally broke the -pcs option (which adds
space between function name and opening parenthesis in function calls) by
copying all but one of a few conditions in an if clause. Reinstate the
condition.

Add a regression test to lower the chances of breaking it again.

Correct a comment with description of what the option does.
This commit is contained in:
Piotr Pawel Stefaniak 2018-06-01 19:56:41 +00:00
parent 9442a64e53
commit 1d01804309
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334493
6 changed files with 23 additions and 1 deletions

View File

@ -556,6 +556,7 @@ main(int argc, char **argv)
}
else 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 */

View File

@ -168,7 +168,7 @@ int procnames_start_line; /* if true, the names of procedures
* the type of the procedure and its
* name) */
int proc_calls_space; /* If true, procedure calls look like:
* foo(bar) rather than foo (bar) */
* foo (bar) rather than foo(bar) */
int format_block_comments; /* true if comments beginning with
* `/ * \n' are to be reformatted */
int format_col1_comments; /* If comments which start in column 1

View File

@ -26,6 +26,9 @@ ${PACKAGE}FILES+= offsetof.0.stdout
${PACKAGE}FILES+= parens.0
${PACKAGE}FILES+= parens.0.stdout
${PACKAGE}FILES+= parens.0.pro
${PACKAGE}FILES+= pcs.0
${PACKAGE}FILES+= pcs.0.stdout
${PACKAGE}FILES+= pcs.0.pro
${PACKAGE}FILES+= sac.0
${PACKAGE}FILES+= sac.0.stdout
${PACKAGE}FILES+= sac.0.pro

View File

@ -0,0 +1,7 @@
/* $FreeBSD$ */
#include <stdio.h>
int main(void) {
puts("Hello");
return 0;
}

View File

@ -0,0 +1,2 @@
/* $FreeBSD$ */
-pcs

View File

@ -0,0 +1,9 @@
/* $FreeBSD$ */
#include <stdio.h>
int
main(void)
{
puts ("Hello");
return 0;
}