Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2018 19:56:42 +0000 (UTC)
From:      Piotr Pawel Stefaniak <pstef@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334493 - in head/usr.bin/indent: . tests
Message-ID:  <201806011956.w51JugHh014734@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pstef
Date: Fri Jun  1 19:56:41 2018
New Revision: 334493
URL: https://svnweb.freebsd.org/changeset/base/334493

Log:
  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.

Added:
  head/usr.bin/indent/tests/pcs.0   (contents, props changed)
  head/usr.bin/indent/tests/pcs.0.pro   (contents, props changed)
  head/usr.bin/indent/tests/pcs.0.stdout   (contents, props changed)
Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent_globs.h
  head/usr.bin/indent/tests/Makefile

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Fri Jun  1 19:47:41 2018	(r334492)
+++ head/usr.bin/indent/indent.c	Fri Jun  1 19:56:41 2018	(r334493)
@@ -556,6 +556,7 @@ check_type:
 	    }
 	    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 */

Modified: head/usr.bin/indent/indent_globs.h
==============================================================================
--- head/usr.bin/indent/indent_globs.h	Fri Jun  1 19:47:41 2018	(r334492)
+++ head/usr.bin/indent/indent_globs.h	Fri Jun  1 19:56:41 2018	(r334493)
@@ -168,7 +168,7 @@ int         procnames_start_line;	/* if true, the name
 					 * 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

Modified: head/usr.bin/indent/tests/Makefile
==============================================================================
--- head/usr.bin/indent/tests/Makefile	Fri Jun  1 19:47:41 2018	(r334492)
+++ head/usr.bin/indent/tests/Makefile	Fri Jun  1 19:56:41 2018	(r334493)
@@ -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

Added: head/usr.bin/indent/tests/pcs.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0	Fri Jun  1 19:56:41 2018	(r334493)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#include <stdio.h>
+
+int main(void) {
+  puts("Hello");
+  return 0;
+}

Added: head/usr.bin/indent/tests/pcs.0.pro
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0.pro	Fri Jun  1 19:56:41 2018	(r334493)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-pcs

Added: head/usr.bin/indent/tests/pcs.0.stdout
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0.stdout	Fri Jun  1 19:56:41 2018	(r334493)
@@ -0,0 +1,9 @@
+/* $FreeBSD$ */
+#include <stdio.h>
+
+int
+main(void)
+{
+	puts ("Hello");
+	return 0;
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806011956.w51JugHh014734>