From 3bd875003c9cfb8544833da3029fc72d93c416b5 Mon Sep 17 00:00:00 2001 From: avg Date: Wed, 31 Mar 2010 17:05:30 +0000 Subject: indent(1): add a new option, -ta, to treat all *_t identifiers as types Submitted by: Hans Petter Selasky Discussed with: bde MFC after: 10 days --- usr.bin/indent/lexi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'usr.bin/indent/lexi.c') diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c index 60fc1ae..3d415d0 100644 --- a/usr.bin/indent/lexi.c +++ b/usr.bin/indent/lexi.c @@ -249,6 +249,17 @@ lexi(void) last_code = ident; /* Remember that this is the code we will * return */ + if (auto_typedefs) { + const char *q = s_token; + /* Check if we have an "_t" in the end */ + if (q[0] && q[1] && + (strcmp(q + strlen(q) - 2, "_t") == 0)) { + ps.its_a_keyword = true; + ps.last_u_d = true; + goto found_auto_typedef; + } + } + /* * This loop will check if the token is a keyword. */ @@ -285,6 +296,7 @@ lexi(void) /* FALLTHROUGH */ case 4: /* one of the declaration keywords */ + found_auto_typedef: if (ps.p_l_follow) { ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.sizeof_mask; break; /* inside parens: cast, param list or sizeof */ -- cgit v1.1