indent(1): Consistently indent declarations.
commit29d3572a134a371772b5b77db7d840b90f638641
authorpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 04:14:20 +0000 (31 04:14 +0000)
committerpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 04:14:20 +0000 (31 04:14 +0000)
tree2051e6ca63811dc05141534bd08af5bb51afcd63
parent5d82fd8a9e706137f46b560a22f82e76741ff67e
indent(1): Consistently indent declarations.

This fixes a very visible issue that may be hidden by some indent.pro
settings as in the example from FreeBSD's /usr/share.

From Piotr's log:
____
To prevent losing tabs from indentation in declarations, FreeBSD indent's
r125624 added code for the most common case when it's an identifier that
is indented, but didn't do anything with the original code that did the
same for any other cases. The other cases are: lparens (function pointer
declaration), asterisks (pointer declaration), stray semicolons, and
commas leading identifiers instead of trailing them.

Use the code added in r125624 (and improved in later commits) to write a
new function indent_declaration() and use it in all places that meant to
indent declarations. In order to indent only once per line, reuse existing
ps.dumped_decl_indent variable that was only used when formatting for
troff (-troff) until now.
____

Reference:
https://github.com/pstef/freebsd_indent/commit/ddd263db2a59978f43468989eff65299cf3ce7e1

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by: Piotr Stefaniak
usr.bin/indent/indent.c