Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: add .indent.pro that almost matches t...



details:   https://anonhg.NetBSD.org/src/rev/e843c6f17bba
branches:  trunk
changeset: 1023810:e843c6f17bba
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 26 19:02:35 2021 +0000

description:
indent: add .indent.pro that almost matches the source code

One might expect that the code of indent is properly indented according
to its own capabilities, but that's not the case, there are many
deviations.

This indentation profile comes close to the existing code. Maybe someday
indent's own source code can be formatted using this profile, but before
attempting that, its remaining bugs have to be fixed.

Development of indent has essentially stopped somewhere around 1990, as
demonstrated by the wrong formatting of '...' that has only been fixed a
few minutes ago. The '...' is an invention of C90. Indent's parser still
considers '...' as consisting of the 3 tokens period-period-period, but
that's OK since the effect is the same.

Another feature that had been missing for a long time were C99 comments
that span from '//' to the next newline. Before March 2021, these were
parsed as a binary operator, which produced lots of funny side effects.

Since indent's code makes use of several C99 features, as soon as it can
properly indent its own code, the worst of these bugs will have been
fixed.

diffstat:

 usr.bin/indent/.indent.pro |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r 4c3df503f470 -r e843c6f17bba usr.bin/indent/.indent.pro
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/indent/.indent.pro        Sun Sep 26 19:02:35 2021 +0000
@@ -0,0 +1,10 @@
+/* $NetBSD: .indent.pro,v 1.1 2021/09/26 19:02:35 rillig Exp $ */
+
+-di0           /* Do not indent variable names in global declarations. */
+-nfc1          /* Do not format CVS Id comments. */
+-i4            /* Indent by 4 spaces, for traditional reasons. */
+-ldi0          /* Do not indent variable names in local declarations. */
+-nlp           /* Do not indent function arguments. */
+-ta            /* Identifiers ending in '_t' are considered type names. */
+-TFILE         /* Additional types, for proper formatting of '*'. */
+-Ttoken_type



Home | Main Index | Thread Index | Old Index