svn commit: r334583 - in head/usr.bin/indent: . tests

Piotr Pawel Stefaniak pstef at FreeBSD.org
Sun Jun 3 19:05:22 UTC 2018


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);
 }


More information about the svn-src-all mailing list