From owner-svn-src-head@freebsd.org Fri Jun 1 09:58:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01ED4FCABF1; Fri, 1 Jun 2018 09:58:46 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9F6B6F9D7; Fri, 1 Jun 2018 09:58:45 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86EF7273BF; Fri, 1 Jun 2018 09:58:45 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519wjcu011619; Fri, 1 Jun 2018 09:58:45 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519wj6X011617; Fri, 1 Jun 2018 09:58:45 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010958.w519wj6X011617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 09:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334480 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:58:46 -0000 Author: pstef Date: Fri Jun 1 09:58:44 2018 New Revision: 334480 URL: https://svnweb.freebsd.org/changeset/base/334480 Log: 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. Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/tests/declarations.0.stdout Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 09:44:23 2018 (r334479) +++ head/usr.bin/indent/indent.c Fri Jun 1 09:58:44 2018 (r334480) @@ -542,15 +542,6 @@ check_type: 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 @@ check_type: } 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; Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:44:23 2018 (r334479) +++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:58:44 2018 (r334480) @@ -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