Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jun 2018 19:05:21 +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: r334583 - in head/usr.bin/indent: . tests
Message-ID:  <201806031905.w53J5LWg063216@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: pstef
Date: Sun Jun  3 19:05:20 2018
New Revision: 334583
URL: https://svnweb.freebsd.org/changeset/base/334583

Log:
  indent(1): if an identifier can be either a typedef name or as a struct
  member, it is taken as the latter

Modified:
  head/usr.bin/indent/lexi.c
  head/usr.bin/indent/tests/parens.0
  head/usr.bin/indent/tests/parens.0.pro
  head/usr.bin/indent/tests/parens.0.stdout

Modified: head/usr.bin/indent/lexi.c
==============================================================================
--- head/usr.bin/indent/lexi.c	Sun Jun  3 18:39:13 2018	(r334582)
+++ head/usr.bin/indent/lexi.c	Sun Jun  3 19:05:20 2018	(r334583)
@@ -321,6 +321,10 @@ lexi(struct parser_state *state)
 		    /* inside parens: cast, param list, offsetof or sizeof */
 		    state->cast_mask |= (1 << state->p_l_follow) & ~state->not_cast_mask;
 		}
+		if (state->last_token == period || state->last_token == unary_op) {
+		    state->keyword = 0;
+		    break;
+		}
 		if (p != NULL && p->rwcode == 3)
 		    return (structure);
 		if (state->p_l_follow)

Modified: head/usr.bin/indent/tests/parens.0
==============================================================================
--- head/usr.bin/indent/tests/parens.0	Sun Jun  3 18:39:13 2018	(r334582)
+++ head/usr.bin/indent/tests/parens.0	Sun Jun  3 19:05:20 2018	(r334583)
@@ -21,4 +21,7 @@ test(void)
 		char	       *xxx = firstf(secondf2(p1,
 						      p2));
 	}
+
+	rb->allocfunc(1);
+	rb2.allocfunc(7);
 }

Modified: head/usr.bin/indent/tests/parens.0.pro
==============================================================================
--- head/usr.bin/indent/tests/parens.0.pro	Sun Jun  3 18:39:13 2018	(r334582)
+++ head/usr.bin/indent/tests/parens.0.pro	Sun Jun  3 19:05:20 2018	(r334583)
@@ -1,2 +1,2 @@
 /* $FreeBSD$ */
--ts4 -i4 -di12
+-ts4 -i4 -di12 -Tallocfunc

Modified: head/usr.bin/indent/tests/parens.0.stdout
==============================================================================
--- head/usr.bin/indent/tests/parens.0.stdout	Sun Jun  3 18:39:13 2018	(r334582)
+++ head/usr.bin/indent/tests/parens.0.stdout	Sun Jun  3 19:05:20 2018	(r334583)
@@ -21,4 +21,7 @@ test(void)
 		char	   *xxx = firstf(secondf2(p1,
 										  p2));
 	}
+
+	rb->allocfunc(1);
+	rb2.allocfunc(7);
 }



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201806031905.w53J5LWg063216>