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: give indent a try at formatting its o...



details:   https://anonhg.NetBSD.org/src/rev/4af88a3a814d
branches:  trunk
changeset: 953594:4af88a3a814d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 00:33:25 2021 +0000

description:
indent: give indent a try at formatting its own code

Formatting indent.h required the following manual corrections
afterwards:

The first tab in the comment in line 1 was replaced with a space but
shouldn't be.

The spacing around the '...' in function prototypes was completely
wrong.  It looked like 'const char *,...)__printflike', without any
spaces.

The '*' of the return type 'const char *' was tied to the function name,
even though this declaration was only for a single function.  In such a
case, it's more appropriate to line up the function names.

The function-like macros were not indented to -di.  This is something
that I would not expect from indent, so it's ok to do that manually.

diffstat:

 usr.bin/indent/indent.h |  49 +++++++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 24 deletions(-)

diffs (63 lines):

diff -r db001aed532f -r 4af88a3a814d usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sun Mar 14 00:22:16 2021 +0000
+++ b/usr.bin/indent/indent.h   Sun Mar 14 00:33:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.15 2021/03/13 23:42:23 rillig Exp $       */
+/*     $NetBSD: indent.h,v 1.16 2021/03/14 00:33:25 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -41,29 +41,30 @@
 #define nitems(array) (sizeof (array) / sizeof (array[0]))
 #endif
 
-void   add_typename(const char *);
-void   alloc_typenames(void);
-int    compute_code_indent(void);
-int    compute_label_indent(void);
-int    indentation_after_range(int, const char *, const char *);
-int    indentation_after(int, const char *);
-void   init_constant_tt(void);
+void           add_typename(const char *);
+void           alloc_typenames(void);
+int            compute_code_indent(void);
+int            compute_label_indent(void);
+int            indentation_after_range(int, const char *, const char *);
+int            indentation_after(int, const char *);
+void           init_constant_tt(void);
 #ifdef debug
-void   debug_vis_range(const char *, const char *, const char *, const char *);
-void   debug_printf(const char *, ...) __printflike(1, 2);
-void   debug_println(const char *, ...) __printflike(1, 2);
-const char *token_type_name(token_type);
+void           debug_vis_range(const char *, const char *, const char *,
+                   const char *);
+void           debug_printf(const char *, ...) __printflike(1, 2);
+void           debug_println(const char *, ...) __printflike(1, 2);
+const char *   token_type_name(token_type);
 #else
-#define debug_printf(fmt, ...) do { } while (false)
-#define debug_println(fmt, ...) do { } while (false)
-#define debug_vis_range(prefix, s, e, suffix) do { } while (false)
+#define                debug_printf(fmt, ...) do { } while (false)
+#define                debug_println(fmt, ...) do { } while (false)
+#define                debug_vis_range(prefix, s, e, suffix) do { } while (false)
 #endif
-token_type lexi(struct parser_state *);
-void   diag(int, const char *, ...) __printflike(2, 3);
-void   dump_line(void);
-void   fill_buffer(void);
-void   parse(token_type);
-void   process_comment(void);
-void   set_defaults(void);
-void   set_option(char *);
-void   set_profile(const char *);
+token_type     lexi(struct parser_state *);
+void           diag(int, const char *, ...) __printflike(2, 3);
+void           dump_line(void);
+void           fill_buffer(void);
+void           parse(token_type);
+void           process_comment(void);
+void           set_defaults(void);
+void           set_option(char *);
+void           set_profile(const char *);



Home | Main Index | Thread Index | Old Index