From owner-svn-src-head@freebsd.org Fri Jun 1 09:41:17 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 EA49EF7D137; Fri, 1 Jun 2018 09:41:16 +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 9BBC26E693; Fri, 1 Jun 2018 09:41:16 +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 65D83271A2; Fri, 1 Jun 2018 09:41:16 +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 w519fGB7003336; Fri, 1 Jun 2018 09:41:16 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519fFYP003330; Fri, 1 Jun 2018 09:41:15 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010941.w519fFYP003330@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:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334478 - 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: 334478 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:41:17 -0000 Author: pstef Date: Fri Jun 1 09:41:15 2018 New Revision: 334478 URL: https://svnweb.freebsd.org/changeset/base/334478 Log: indent(1): don't indent typedef declarations as object declarations Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_codes.h head/usr.bin/indent/lexi.c head/usr.bin/indent/tests/declarations.0 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:32:42 2018 (r334477) +++ head/usr.bin/indent/indent.c Fri Jun 1 09:41:15 2018 (r334478) @@ -937,6 +937,7 @@ check_type: } goto copy_id; /* move the token into line */ + case type_def: case storage: prefix_blankline_requested = 0; goto copy_id; @@ -955,7 +956,7 @@ check_type: } ps.in_or_st = true; /* this might be a structure or initialization * declaration */ - ps.in_decl = ps.decl_on_line = true; + ps.in_decl = ps.decl_on_line = ps.last_token != type_def; if ( /* !ps.in_or_st && */ ps.dec_nest <= 0) ps.just_saw_decl = 2; prefix_blankline_requested = 0; Modified: head/usr.bin/indent/indent_codes.h ============================================================================== --- head/usr.bin/indent/indent_codes.h Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/indent_codes.h Fri Jun 1 09:41:15 2018 (r334478) @@ -73,3 +73,5 @@ #define strpfx 33 #define storage 34 #define funcname 35 +#define type_def 36 + Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/lexi.c Fri Jun 1 09:41:15 2018 (r334478) @@ -100,7 +100,7 @@ struct templ specials[] = {"static", 10}, {"struct", 3}, {"switch", 7}, - {"typedef", 10}, + {"typedef", 11}, {"union", 3}, {"unsigned", 4}, {"void", 4}, @@ -349,6 +349,9 @@ lexi(void) case 10: /* storage class specifier */ return (storage); + + case 11: /* typedef */ + return (type_def); default: /* all others are treated like any other * identifier */ Modified: head/usr.bin/indent/tests/declarations.0 ============================================================================== --- head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:41:15 2018 (r334478) @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /* See r303570 */ +typedef void (*voidptr) (int *); + static const struct { double x; Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:41:15 2018 (r334478) @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /* See r303570 */ +typedef void (*voidptr) (int *); + static const struct { double x; double y, z;