Sun Mar 14 00:33:25 2021 UTC ()
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.


(rillig)
diff -r1.15 -r1.16 src/usr.bin/indent/indent.h

cvs diff -r1.15 -r1.16 src/usr.bin/indent/indent.h (expand / switch to unified diff)

--- src/usr.bin/indent/indent.h 2021/03/13 23:42:23 1.15
+++ src/usr.bin/indent/indent.h 2021/03/14 00:33:25 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: indent.h,v 1.15 2021/03/13 23:42:23 rillig Exp $ */ 1/* $NetBSD: indent.h,v 1.16 2021/03/14 00:33:25 rillig Exp $ */
2 2
3/*- 3/*-
4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 * 5 *
6 * Copyright (c) 2001 Jens Schweikhardt 6 * Copyright (c) 2001 Jens Schweikhardt
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -31,39 +31,40 @@ @@ -31,39 +31,40 @@
31#if 0 31#if 0
32#if defined(__FreeBSD__) 32#if defined(__FreeBSD__)
33__FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $"); 33__FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $");
34#endif 34#endif
35#endif 35#endif
36 36
37#include "indent_codes.h" 37#include "indent_codes.h"
38#include "indent_globs.h" 38#include "indent_globs.h"
39 39
40#ifndef nitems 40#ifndef nitems
41#define nitems(array) (sizeof (array) / sizeof (array[0])) 41#define nitems(array) (sizeof (array) / sizeof (array[0]))
42#endif 42#endif
43 43
44void add_typename(const char *); 44void add_typename(const char *);
45void alloc_typenames(void); 45void alloc_typenames(void);
46int compute_code_indent(void); 46int compute_code_indent(void);
47int compute_label_indent(void); 47int compute_label_indent(void);
48int indentation_after_range(int, const char *, const char *); 48int indentation_after_range(int, const char *, const char *);
49int indentation_after(int, const char *); 49int indentation_after(int, const char *);
50void init_constant_tt(void); 50void init_constant_tt(void);
51#ifdef debug 51#ifdef debug
52void debug_vis_range(const char *, const char *, const char *, const char *); 52void debug_vis_range(const char *, const char *, const char *,
53void debug_printf(const char *, ...) __printflike(1, 2); 53 const char *);
54void debug_println(const char *, ...) __printflike(1, 2); 54void debug_printf(const char *, ...) __printflike(1, 2);
55const char *token_type_name(token_type); 55void debug_println(const char *, ...) __printflike(1, 2);
 56const char * token_type_name(token_type);
56#else 57#else
57#define debug_printf(fmt, ...) do { } while (false) 58#define debug_printf(fmt, ...) do { } while (false)
58#define debug_println(fmt, ...) do { } while (false) 59#define debug_println(fmt, ...) do { } while (false)
59#define debug_vis_range(prefix, s, e, suffix) do { } while (false) 60#define debug_vis_range(prefix, s, e, suffix) do { } while (false)
60#endif 61#endif
61token_type lexi(struct parser_state *); 62token_type lexi(struct parser_state *);
62void diag(int, const char *, ...) __printflike(2, 3); 63void diag(int, const char *, ...) __printflike(2, 3);
63void dump_line(void); 64void dump_line(void);
64void fill_buffer(void); 65void fill_buffer(void);
65void parse(token_type); 66void parse(token_type);
66void process_comment(void); 67void process_comment(void);
67void set_defaults(void); 68void set_defaults(void);
68void set_option(char *); 69void set_option(char *);
69void set_profile(const char *); 70void set_profile(const char *);