The NetBSD Project

CVS log for src/usr.bin/indent/io.c

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / indent

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.148 / (download) - annotate - [select for diffs], Sat Apr 23 06:43:22 2022 UTC (9 months ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.147: +19 -20 lines
Diff to previous 1.147 (colored)

indent: group global variables related to output control

No functional change.

Revision 1.147 / (download) - annotate - [select for diffs], Sun Feb 13 12:48:12 2022 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.146: +4 -4 lines
Diff to previous 1.146 (colored)

indent: consistently use nparen for indexing parser_state.paren

No binary change.

Revision 1.146 / (download) - annotate - [select for diffs], Sun Feb 13 12:43:26 2022 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.145: +8 -8 lines
Diff to previous 1.145 (colored)

indent: rename parser_state.p_l_follow and paren_level

The previous variable names were misleading.

Paren_level is not the current level of parentheses but the one from the
beginning of the current output line.  For better accuracy, rename it to
line_start_paren_level.

P_l_follow is not the level of parentheses that will be active at some
point in the future, as the previous name suggested.  Instead, it is the
level of parentheses right now.  For better accuracy, rename it to
nparen.  This nicely matches its main usage, which is as index to the
parser_state.paren array.

No binary change.

Revision 1.145 / (download) - annotate - [select for diffs], Sun Feb 13 12:20:09 2022 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.144: +7 -7 lines
Diff to previous 1.144 (colored)

indent: replace bitmasking code with struct

The struct directly represents the properties of a pair of parentheses,
without forcing the human reader to decode any bitset.  This makes it
easier to find the remaining bugs in the heuristic for determining the
kind of parentheses.

No functional change outside debug mode.

Revision 1.144 / (download) - annotate - [select for diffs], Sat Feb 12 19:56:52 2022 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.143: +3 -3 lines
Diff to previous 1.143 (colored)

indent: fix indentation of enum constants in typedef (since 2019-04-04)

The solution is not elegant since it adds a small state machine inside
the parser state, but at least these states only depend on the sequence
of token types and not on any other part of the parser state.

Reported in PR#55453.

Revision 1.143 / (download) - annotate - [select for diffs], Sun Nov 28 11:49:10 2021 UTC (13 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.142: +53 -16 lines
Diff to previous 1.142 (colored)

indent: clean up and document input handling

The transformation of moving comments from after an 'if (expr)' after
the following brace has a large implementation cost (about 300 lines of
code) and makes input handling quite complicated. Document the overall
idea to save future readers some time.

No functional change.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Nov 27 21:15:58 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.141: +9 -10 lines
Diff to previous 1.141 (colored)

indent: accept a few formatting suggestions from indent

The remaining issues are still that the conditions look ambiguous even
with -eei, and that __attribute__ is broken into a separate line.

No functional change.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Nov 27 18:37:17 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.140: +14 -14 lines
Diff to previous 1.140 (colored)

indent: rename dump functions to output

No functional change.

Revision 1.140 / (download) - annotate - [select for diffs], Sat Nov 27 18:26:48 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.139: +6 -2 lines
Diff to previous 1.139 (colored)

indent: add assertions for input handling

Just to document the invariants; the code is already OK.

Revision 1.139 / (download) - annotate - [select for diffs], Fri Nov 26 15:21:38 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.138: +23 -12 lines
Diff to previous 1.138 (colored)

indent: enhance debug logging for input handling

Revision 1.138 / (download) - annotate - [select for diffs], Fri Nov 26 15:08:48 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.137: +21 -22 lines
Diff to previous 1.137 (colored)

indent: replace inp_enlarge with inp_add

Previously, inbuf.inp.s was only updated at the very end of reading a
line from the input file, which meant that during debugging, it pointed
to invalid memory. Updating all fields in inbuf.inp after every
reallocation makes the code less tricky to understand.

No functional change.

Revision 1.137 / (download) - annotate - [select for diffs], Fri Nov 26 14:48:03 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.136: +43 -45 lines
Diff to previous 1.136 (colored)

indent: split inp_read_line into smaller functions

No functional change.

Revision 1.136 / (download) - annotate - [select for diffs], Fri Nov 26 14:33:12 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.135: +21 -11 lines
Diff to previous 1.135 (colored)

indent: extract inp_from_file from inp_read_line

No functional change.

Revision 1.135 / (download) - annotate - [select for diffs], Fri Nov 26 14:27:19 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.134: +3 -27 lines
Diff to previous 1.134 (colored)

indent: remove code that fixes malformed preprocessor directives

Revision 1.134 / (download) - annotate - [select for diffs], Fri Nov 26 14:17:01 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.133: +2 -18 lines
Diff to previous 1.133 (colored)

indent: move ind_add from io.c to indent.c

It's a general-purpose function that is not directly related to input or
output.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Nov 25 21:59:40 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.132: +3 -8 lines
Diff to previous 1.132 (colored)

indent: prevent undefined behavior in inp_line_start

No functional change.

Revision 1.132 / (download) - annotate - [select for diffs], Thu Nov 25 20:00:31 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.131: +6 -6 lines
Diff to previous 1.131 (colored)

indent: update cross-reference comments for bug in comment handling

The function was renamed in io.c 1.122 from 2021-11-19.

Revision 1.131 / (download) - annotate - [select for diffs], Thu Nov 25 07:45:32 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.130: +3 -3 lines
Diff to previous 1.130 (colored)

indent: rename ps.in_stmt to in_stmt_or_decl

The previous name didn't match reality.

No functional change.

Revision 1.130 / (download) - annotate - [select for diffs], Thu Nov 25 07:41:13 2021 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.129: +5 -7 lines
Diff to previous 1.129 (colored)

indent: rename ps.ind_stmt to in_stmt_cont

This makes a comment redundant.

No functional change.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Nov 19 20:23:17 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.128: +3 -4 lines
Diff to previous 1.128 (colored)

indent: reduce casts to unsigned char for character classification

No functional change.

Revision 1.128 / (download) - annotate - [select for diffs], Fri Nov 19 20:13:05 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.127: +5 -6 lines
Diff to previous 1.127 (colored)

indent: keep inbuf.save_com_s and inbuf.save_com_e in sync

No functional change.

Revision 1.127 / (download) - annotate - [select for diffs], Fri Nov 19 20:04:02 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.126: +2 -3 lines
Diff to previous 1.126 (colored)

indent: fix included headers

Revision 1.126 / (download) - annotate - [select for diffs], Fri Nov 19 20:01:37 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.125: +9 -8 lines
Diff to previous 1.125 (colored)

indent: clean up io.c

No functional change.

Revision 1.125 / (download) - annotate - [select for diffs], Fri Nov 19 19:55:15 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.124: +3 -3 lines
Diff to previous 1.124 (colored)

indent: replace ps.procname with ps.is_function_definition

Omly the first character of ps.procname was ever read, and it was only
compared to '\0'.  Using a bool for this means simpler code, less
memory and fewer wasted CPU cycles due to the removed strncpy.

No functional change.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Nov 19 18:25:50 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.123: +15 -3 lines
Diff to previous 1.123 (colored)

indent: unexport inbuf

No functional change.

Revision 1.123 / (download) - annotate - [select for diffs], Fri Nov 19 18:23:59 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.122: +17 -2 lines
Diff to previous 1.122 (colored)

indent: use character input API from pr_comment.c

No functional change.

Revision 1.122 / (download) - annotate - [select for diffs], Fri Nov 19 18:14:18 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.121: +52 -2 lines
Diff to previous 1.121 (colored)

indent: remove all references to inbuf from indent.c

No functional change.

Revision 1.121 / (download) - annotate - [select for diffs], Fri Nov 19 17:59:16 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.120: +58 -2 lines
Diff to previous 1.120 (colored)

indent: move character input handling from indent.c to io.c

No functional change.

Revision 1.120 / (download) - annotate - [select for diffs], Fri Nov 19 17:42:45 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.119: +65 -2 lines
Diff to previous 1.119 (colored)

indent: move character input from indent.c to io.c

No functional change.

Revision 1.119 / (download) - annotate - [select for diffs], Fri Nov 19 17:30:10 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.118: +14 -2 lines
Diff to previous 1.118 (colored)

indent: use character input API from the tokenizer

No functional change.

Revision 1.118 / (download) - annotate - [select for diffs], Fri Nov 19 17:20:57 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.117: +32 -2 lines
Diff to previous 1.117 (colored)

indent: move character input handling from lexi.c to io.c

No functional change.

Revision 1.117 / (download) - annotate - [select for diffs], Fri Nov 19 15:28:32 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.116: +19 -19 lines
Diff to previous 1.116 (colored)

indent: group variables for input handling

No functional change.

Revision 1.116 / (download) - annotate - [select for diffs], Sun Nov 7 07:06:00 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored)

indent: rename 'inbuf' functions to 'inp'

The variable 'inp' used to be named 'inbuf'. Make the function names
correspond to the variable name again.

No functional change.

Revision 1.115 / (download) - annotate - [select for diffs], Fri Nov 5 21:39:12 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.114: +3 -4 lines
Diff to previous 1.114 (colored)

indent: the '+ 1' in dump_line_code is not an off-by-one error

Revision 1.114 / (download) - annotate - [select for diffs], Thu Nov 4 19:23:57 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.113: +4 -8 lines
Diff to previous 1.113 (colored)

indent: do not discard former error comments anymore

Since io.c 1.20 from 2019-10-19, indent has not placed error comments in
the code anymore. Since these comments are supposed to be cleaned up
immediately, there is no point in having code for handling them.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Nov 4 17:10:37 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.112: +21 -16 lines
Diff to previous 1.112 (colored)

indent: extract compute_code_indent_lineup into separate function

Having 9 different paths in a single function made it more complicated
to understand than necessary.

No functional change.

Revision 1.112 / (download) - annotate - [select for diffs], Thu Nov 4 17:08:50 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.111: +6 -12 lines
Diff to previous 1.111 (colored)

indent: fix off-by-one confusion in paren_indent

The variable was called 'indent' but actually contained a 'column',
which was off by one.

No functional change.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Nov 4 17:07:02 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.110: +12 -12 lines
Diff to previous 1.110 (colored)

indent: replace column computation with indentation computation

No functional change.

Revision 1.110 / (download) - annotate - [select for diffs], Thu Nov 4 00:13:57 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.109: +28 -25 lines
Diff to previous 1.109 (colored)

indent: group conditions in compute_code_indent by topic

No functional change.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Nov 3 21:47:35 2021 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.108: +10 -16 lines
Diff to previous 1.108 (colored)

indent: inline indentation_after, shorten function name to ind_add

There were only few calls to indentation_after, so inlining it spares
the need to look at yet another function definition. Another effect is
that code.s and code.e appear in the code as a pair now, instead of a
single code.s, making the scope of the function call obvious.

In ind_add, there is no need to check for '\0' anymore since none of the
buffers can ever contain a null character, these are filtered out by
inbuf_read_line.

No functional change.

Revision 1.108 / (download) - annotate - [select for diffs], Sat Oct 30 11:49:38 2021 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.107: +3 -3 lines
Diff to previous 1.107 (colored)

indent: inline macro label_offset

No functional change.

Revision 1.107 / (download) - annotate - [select for diffs], Fri Oct 29 20:27:42 2021 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.106: +10 -10 lines
Diff to previous 1.106 (colored)

indent: merge isblank and is_hspace into ch_isblank

No functional change.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Oct 29 19:12:48 2021 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.105: +4 -4 lines
Diff to previous 1.105 (colored)

indent: fix undefined behavior in buffer handling

Adding an arbitrary integer to a pointer may result in an out of bounds
pointer, so replace the addition with a pointer subtraction.

In the buffer handling functions, handle 'buf' and 'l' before 's' and
'e', since they are pairs.

In inbuf_read_line, use 's' instead of 'buf' to make the code easier to
understand for human readers.

No functional change.

Revision 1.105 / (download) - annotate - [select for diffs], Fri Oct 29 18:18:03 2021 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.104: +6 -6 lines
Diff to previous 1.104 (colored)

indent: reorder global variables to be more intuitive

The buffer 'inp' comes first. From there, a single token is read into
the buffer 'token'. From there, it usually ends up in 'code'. The buffer
'token' does not belong to the group of the other 3 buffers, which
together make up a line of formatted output.

No functional change.

Revision 1.104 / (download) - annotate - [select for diffs], Fri Oct 29 17:32:22 2021 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored)

indent: rename ps.dumped_decl_indent and indent_declaration

The word 'dump' in 'ps.dumped_decl_indent' was too close to dump_line,
which led to confusion since the variable controls whether the
indentation has been added to the code buffer, which happens way before
actually dumping the current line to the output file.

The function name 'indent_declaration' was too unspecific, it did not
reveal where the indentation of the declaration actually happened.

No functional change.

Revision 1.103 / (download) - annotate - [select for diffs], Wed Oct 27 00:04:51 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.102: +3 -6 lines
Diff to previous 1.102 (colored)

indent: fix indentation of local variable declarations

This had been broken since the import of FreeBSD indent in 2019.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Oct 24 17:19:48 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.101: +2 -25 lines
Diff to previous 1.101 (colored)

indent: clean up format of warnings and errors

Previously, warnings and errors had the form of C block comments. Before
NetBSD io.c 1.20 from 2019-10-19, this format made sense because the
diagnostics could end up in the same output stream as the formatted
output.

Since NetBSD io.c 1.20 from 2019-10-19, all diagnostics are redirected
to stderr. This change was not mentioned in the commit message back
then, it makes sense nevertheless. Since stdout and stderr now are
properly separated, there is no need anymore to keep the weird format
for warnings and errors. Switch to the standard 'error: file:line'
format.

Move the function 'diag' to indent.c to have access to the name of the
current input file.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Oct 24 11:17:05 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.100: +17 -9 lines
Diff to previous 1.100 (colored)

indent: replace global variable use_ff with function parameter

Revision 1.100 / (download) - annotate - [select for diffs], Sun Oct 24 10:54:12 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

indent: sort includes

Revision 1.99 / (download) - annotate - [select for diffs], Wed Oct 20 05:14:21 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.98: +8 -8 lines
Diff to previous 1.98 (colored)

indent: rename blankline_requested variables

The words 'prefix' and 'postfix' sounded too much like horizontal
concepts, like in operators. The actual purpose of these variables is to
add blank lines before and after the current line, so use the same
wording as in the command line options.

No functional change.

Revision 1.98 / (download) - annotate - [select for diffs], Wed Oct 20 05:00:37 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.97: +9 -9 lines
Diff to previous 1.97 (colored)

indent: rename next_blank_lines to blank_lines_to_output

The previous name was already an improvement over the name before that
(n_real_blanklines), but didn't express the intended purpose clearly
enough, so try another name.

No functional change.

Revision 1.97 / (download) - annotate - [select for diffs], Tue Oct 19 21:39:19 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.96: +3 -4 lines
Diff to previous 1.96 (colored)

indent: always keep next_blank_lines >= 0

No functional change.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Oct 19 21:21:07 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.95: +4 -6 lines
Diff to previous 1.95 (colored)

indent: use simpler code for copying the input buffer

In debug mode, this reduces the amount of debug output lines.

No functional change in default mode.

Revision 1.95 / (download) - annotate - [select for diffs], Tue Oct 19 18:29:59 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.94: +7 -7 lines
Diff to previous 1.94 (colored)

indent: if a file ends with indent off, don't add space-newline

Revision 1.94 / (download) - annotate - [select for diffs], Mon Oct 11 19:04:47 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.93: +7 -7 lines
Diff to previous 1.93 (colored)

indent: use bool for suppress_blanklines

It only ever got assigned the values 0 and 1.

No functional change.

Revision 1.93 / (download) - annotate - [select for diffs], Mon Oct 11 18:55:49 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.92: +2 -12 lines
Diff to previous 1.92 (colored)

indent: remove dead code

Revision 1.92 / (download) - annotate - [select for diffs], Sat Oct 9 11:13:25 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.91: +14 -13 lines
Diff to previous 1.91 (colored)

indent: condense code for calculating indentations

No functional change.

Revision 1.91 / (download) - annotate - [select for diffs], Sat Oct 9 11:00:27 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.90: +4 -4 lines
Diff to previous 1.90 (colored)

indent: extract common code for advancing a single tab

No functional change.

Revision 1.90 / (download) - annotate - [select for diffs], Fri Oct 8 21:16:23 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.89: +10 -10 lines
Diff to previous 1.89 (colored)

indent: improve local variable names

No functional change.

Revision 1.89 / (download) - annotate - [select for diffs], Fri Oct 8 21:13:58 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.88: +6 -9 lines
Diff to previous 1.88 (colored)

indent: rename fill_buffer to inbuf_read_line

No functional change.

Revision 1.88 / (download) - annotate - [select for diffs], Fri Oct 8 19:03:34 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

indent: run indent on indent.h

The formatting looks mostly OK.

Some struct members had excessively long names, leaving no space for
their corresponding comments. Renamed some of them using well-known
abbreviations.

The formatting for debug_vis_range is messed up, no idea why. It is
clearly a function declaration, not a function definition, so there is
no need to place the function name in column 1.

No functional change.

Revision 1.87 / (download) - annotate - [select for diffs], Fri Oct 8 18:29:36 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.86: +2 -7 lines
Diff to previous 1.86 (colored)

indent: fix formatting of C99 comments

The first attempt at formatting C99 comments was conceptually wrong. It
accessed the next token in dump_line, even though that function should
only ever look at the buffers for the label, the code and the current
comment. (Understanding that part of the code was difficult at that time
due to the sheer number of global variables.) The complicated and
ever-growing condition for whether to output the token was a hack and in
retrospect doesn't make sense at all, that's why it only came close to
the intended effect.

Some unintended side effects were that the C99 comments had an
additional space in front of them, and that in some cases an empty line
followed the comment, and that the comments were not aligned.

Previously, the newline that terminates the C99 comment was included in
the comment. Separating the newline from the comment fixed all these
unintended side effects. The only downside is that the multi-line
statement is not indented, but that should be easy to fix.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Oct 8 17:56:12 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.85: +121 -101 lines
Diff to previous 1.85 (colored)

indent: split dump_line into smaller functions

No functional change.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Oct 8 17:19:49 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.84: +3 -3 lines
Diff to previous 1.84 (colored)

indent: replace column calculations with indent, part 4/4

Revision 1.84 / (download) - annotate - [select for diffs], Fri Oct 8 17:12:08 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.83: +7 -10 lines
Diff to previous 1.83 (colored)

indent: replace column calculations with indent, part 3

No functional change.

Revision 1.83 / (download) - annotate - [select for diffs], Fri Oct 8 17:07:36 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.82: +11 -11 lines
Diff to previous 1.82 (colored)

indent: replace column calculations with indent, part 2

No functional change.

Revision 1.82 / (download) - annotate - [select for diffs], Fri Oct 8 17:04:13 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.81: +11 -11 lines
Diff to previous 1.81 (colored)

indent: calculate indentation instead of column

This avoids constantly adding and subtracting 1.

No functional change.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Oct 8 17:00:21 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.80: +15 -18 lines
Diff to previous 1.80 (colored)

indent: reduce indentation in dump_line

Revision 1.80 / (download) - annotate - [select for diffs], Thu Oct 7 23:18:47 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.79: +7 -7 lines
Diff to previous 1.79 (colored)

indent: rename bp_save to saved_inp_s, be_save to saved_inp_e

Using the same naming convention makes it easier to relate the
variables.

No functional change.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Oct 7 23:15:15 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.78: +19 -19 lines
Diff to previous 1.78 (colored)

indent: group variables for the input buffer

The input buffer follows the same concept as the intermediate buffers
for label, code, comment and token, so use the same type for it.

No functional change.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Oct 7 21:57:21 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.77: +5 -5 lines
Diff to previous 1.77 (colored)

indent: use braces around multi-line statements

No functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Oct 7 21:52:54 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.76: +30 -3 lines
Diff to previous 1.76 (colored)

indent: let the code breathe a bit by inserting empty lines

No functional change.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Oct 7 21:38:25 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.75: +4 -10 lines
Diff to previous 1.75 (colored)

indent: remove redundant comments

No functional change.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Oct 7 19:35:50 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (colored)

indent: clean up colon handling

No functional change.

Revision 1.74 / (download) - annotate - [select for diffs], Thu Oct 7 18:32:09 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.73: +6 -6 lines
Diff to previous 1.73 (colored)

indent: raise WARNS from the default 5 up to 6

Revision 1.73 / (download) - annotate - [select for diffs], Tue Oct 5 21:05:12 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.72: +24 -25 lines
Diff to previous 1.72 (colored)

indent: rewrite parse_indent_comment for human readers

The generated code is still very similar, GCC does a good job at
inlining strncmp.

No functional change.

Revision 1.72 / (download) - annotate - [select for diffs], Tue Oct 5 18:50:42 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.71: +10 -10 lines
Diff to previous 1.71 (colored)

indent: rename n_real_blanklines

The word 'n' was not as helpful as possible, the word 'real' did not
give any clue at all about the variable's purpose.

No functional change.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Oct 5 06:24:06 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.70: +7 -7 lines
Diff to previous 1.70 (colored)

indent: rename local char variable, reduce scope of counters

No functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Tue Oct 5 06:15:24 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

indent: use proper escape sequence for form feed

This escape sequence has been available since at least 1978.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Oct 5 06:09:42 2021 UTC (15 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored)

indent: merge duplicate code into is_hspace

No functional change.

Revision 1.68 / (download) - annotate - [select for diffs], Sun Sep 26 21:23:31 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.67: +3 -2 lines
Diff to previous 1.67 (colored)

indent: unexport global variables

The variable match_state was write-only and was thus removed.

No functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Sun Sep 26 19:37:11 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.66: +29 -25 lines
Diff to previous 1.66 (colored)

indent: let indent format its own code -- in supervised mode

After running indent on the code, I manually selected each change that
now looks better than before. The remaining changes are left for later.
All in all, indent did a pretty good job, except for syntactic additions
from after 1990, but that was to be expected. Examples for such
additions are GCC's __attribute__ and C99 designated initializers.

Indent has only few knobs to tune the indentation. The knob for the
continuation indentation applies to function declarations as well as to
expressions. The knob for indentation of local variable declarations
applies to struct members as well, even if these are members of a
top-level struct.

Several code comments crossed the right margin in column 78. Several
other code comments were correctly broken though. The cause for this
difference was not obvious.

No functional change.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Sep 25 22:57:04 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.65: +3 -5 lines
Diff to previous 1.65 (colored)

indent: misc cleanup

No functional change.

Revision 1.65 / (download) - annotate - [select for diffs], Sat Sep 25 22:54:32 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.64: +3 -3 lines
Diff to previous 1.64 (colored)

indent: convert found_err to bool

That variable had slipped through the migration since it consequently
used int for the declaration, the definition and all assignments.

No functional change.

Revision 1.64 / (download) - annotate - [select for diffs], Sat Sep 25 20:56:53 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.63: +3 -3 lines
Diff to previous 1.63 (colored)

indent: un-abbreviate a few parser_state members, clean up comments

No functional change.

Revision 1.63 / (download) - annotate - [select for diffs], Sat Sep 25 20:23:42 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.62: +3 -6 lines
Diff to previous 1.62 (colored)

indent: remove dead code for printing comments after empty lines

This code has been commented out for at least 29 years.

No functional change.

Revision 1.62 / (download) - annotate - [select for diffs], Sat Sep 25 17:36:51 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.61: +5 -9 lines
Diff to previous 1.61 (colored)

indent: convert remaining ibool to bool

No functional change intended.

Revision 1.61 / (download) - annotate - [select for diffs], Sat Sep 25 17:29:13 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.60: +2 -8 lines
Diff to previous 1.60 (colored)

indent: convert parser_state from ibool to bool

indent.c:400:5: error: suggest parentheses around assignment used as
    truth value
io.c:271:32: error: on a boolean expression

No functional change intended.

Revision 1.60 / (download) - annotate - [select for diffs], Sat Sep 25 17:11:23 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.59: +26 -16 lines
Diff to previous 1.59 (colored)

indent: prepare for lint's strict bool mode

Before C99, C had no boolean type. Instead, indent used int for that,
just like many other programs. Even with C99, bool and int can be used
interchangeably in many situations, such as querying '!i' or '!ptr' or
'cond == 0'.

Since January 2021, lint provides the strict bool mode, which makes bool
a non-arithmetic type that is incompatible with any other type. Having
clearly separate types helps in understanding the code.

To migrate indent to strict bool mode, the first step is to apply all
changes that keep the resulting binary the same. Since sizeof(bool) is
1 and sizeof(int) is 4, the type ibool serves as an intermediate type.
For now it is defined to int, later it will become bool.

The current code compiles cleanly in C99 and C11 mode, as well as in
lint's strict bool mode. There are a few tricky places:

In args.c in 'struct pro', there are two types of options: boolean and
integer. Boolean options point to a bool variable, integer options
point to an int variable. To keep the current structure of the code,
the pointer has been changed to 'void *'. To ensure type safety, the
definition of the options is done via preprocessor magic, which in C11
mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the
very bottom of the Makefile.)

In indent.c in process_preprocessing, a boolean variable is
post-incremented. That variable is only assigned to another variable,
and that variable is only used in a boolean context. To provoke a
different behavior between the '++' and the '= true', the source code
to be indented would need 1 << 32 preprocessing directives, which is
unlikely to happen in practice.

In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever
get the values 0 and 1. For these values, the expressions 'a & ~b' and
'a && !b' are equivalent, in all versions of C. The compiler may
generate different code for them, though.

In io.c in parse_indent_comment, the assignment to inhibit_formatting
takes place in integer context. If the compiler is smart enough to
detect the possible values of on_off, it may generate the same code
before and after the change, but that is rather unlikely.

The second step of the migration will be to replace ibool with bool,
step by step, just in case there are any hidden gotchas in the code,
such as sizeof or pointer casts.

No change to the resulting binary.

Revision 1.59 / (download) - annotate - [select for diffs], Sat Sep 25 13:38:32 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.58: +2 -6 lines
Diff to previous 1.58 (colored)

indent: remove ifdef for lint

NetBSD lint does not need them anymore, FreeBSD does not have lint.

Revision 1.58 / (download) - annotate - [select for diffs], Sat Sep 25 10:41:03 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.57: +6 -6 lines
Diff to previous 1.57 (colored)

indent: move statistical values into a separate struct

No functional change.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Sep 25 08:23:31 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.56: +3 -5 lines
Diff to previous 1.56 (colored)

indent: add nonnull memory allocation functions

The only functional change is a single error message.

Revision 1.56 / (download) - annotate - [select for diffs], Sat Sep 25 08:04:13 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.55: +4 -4 lines
Diff to previous 1.55 (colored)

indent: group global variables for token buffer

No functional change.

Revision 1.55 / (download) - annotate - [select for diffs], Sat Sep 25 07:55:24 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.54: +11 -11 lines
Diff to previous 1.54 (colored)

indent: group global variables for code buffer

No functional change.

Revision 1.54 / (download) - annotate - [select for diffs], Fri Sep 24 18:47:29 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.53: +22 -22 lines
Diff to previous 1.53 (colored)

indent: group global variables for label buffer into struct

No functional change.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Sep 24 18:37:03 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.52: +59 -40 lines
Diff to previous 1.52 (colored)

indent: extract parse_indent_comment from fill_buffer

No functional change.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Sep 24 18:14:06 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.51: +11 -11 lines
Diff to previous 1.51 (colored)

indent: group global variables for the comment buffer

No functional change.

Revision 1.51 / (download) - annotate - [select for diffs], Fri Sep 24 18:00:13 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.50: +8 -8 lines
Diff to previous 1.50 (colored)

indent: rename local variable in fill_buffer

The local variable name 'com' prevented grouping the global variables
combuf, s_com, e_com and l_com into a struct named 'com'.

No functional change.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Sep 24 16:29:31 2021 UTC (16 months ago) by rillig
Branch: MAIN
Changes since 1.49: +4 -3 lines
Diff to previous 1.49 (colored)

indent: fix token duplication after C99 comment

The code that keeps blank lines after C99 comments still looks wrong,
but at least it's better than before.

Revision 1.49 / (download) - annotate - [select for diffs], Sun Mar 14 01:44:37 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.48: +6 -4 lines
Diff to previous 1.48 (colored)

indent: make compute_code_indent more readable

The '?:' operator computing the factor was too hard to read.  When
quickly scanning the code, the 1 in the expression looked too much like
it would be added to the indentation, which would turn the indentation
length into a column number, and that again would smell like an
off-by-one error.

No functional change.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Mar 14 00:22:16 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.47: +4 -4 lines
Diff to previous 1.47 (colored)

indent: fix lint warnings

No functional change.

Revision 1.47 / (download) - annotate - [select for diffs], Sat Mar 13 18:46:39 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.46: +3 -2 lines
Diff to previous 1.46 (colored)

indent: add debug logging for switching the input buffer

No functional change outside debug mode.

Revision 1.46 / (download) - annotate - [select for diffs], Sat Mar 13 18:24:56 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.45: +10 -12 lines
Diff to previous 1.45 (colored)

indent: align comments in indent's own code

No functional change.

Revision 1.45 / (download) - annotate - [select for diffs], Sat Mar 13 13:55:42 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.44: +11 -11 lines
Diff to previous 1.44 (colored)

indent: rename local variable in dump_line

This clarifies that the variable names a column, not an indentation.

Revision 1.44 / (download) - annotate - [select for diffs], Sat Mar 13 13:54:01 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.43: +4 -4 lines
Diff to previous 1.43 (colored)

indent: in dump_line, reduce scope of local variable

This allows the variable 'target' in the lower half of the function to
get a more specific name.

No functional change.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Mar 13 13:51:08 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.42: +6 -6 lines
Diff to previous 1.42 (colored)

indent: distinguish between 'column' and 'indentation'

column == 1 + indentation.

In addition, indentation is a relative distance while column is an
absolute position.  Therefore, don't confuse these two concepts, to
prevent off-by-one errors.

No functional change.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Mar 13 11:19:43 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

indent: fix confusing variable names

The word 'col' should only be used for the 1-based column number.  This
name is completely inappropriate for a line length since that provokes
off-by-one errors.  The name 'cols' would be acceptable although
confusing since it sounds so similar to 'col'.

Therefore, rename variables that are related to the maximum line length
to 'line_length' since that makes for obvious code and nicely relates to
the description of the option in the manual page.

No functional change.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Mar 13 10:32:25 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.40: +6 -18 lines
Diff to previous 1.40 (colored)

indent: inline calls to count_spaces and count_spaces_until

These two functions operated on column numbers instead of indentation,
which required adjustments of '+ 1' and '- 1'.  Their names were
completely wrong since these functions did not count anything, instead
they computed the column.

No functional change.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Mar 13 10:20:54 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.39: +26 -30 lines
Diff to previous 1.39 (colored)

indent: replace column computation with indentation computation

No functional change.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Mar 13 10:06:47 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.38: +19 -14 lines
Diff to previous 1.38 (colored)

indent: replace compute_code_column with compute_code_indent

The goal is to only ever be concerned about the _indentation_ of a
token, never the _column_ it appears in.  Having only one of these
avoids off-by-one errors.

No functional change.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Mar 13 09:54:11 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.37: +9 -8 lines
Diff to previous 1.37 (colored)

indent: replace compute_label_column with compute_label_indent

Using the invariant 'column == 1 + indent'.  This removes several overly
complicated '+ 1' from the code that are not needed conceptually.

No functional change.

Revision 1.37 / (download) - annotate - [select for diffs], Sat Mar 13 09:48:04 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.36: +8 -8 lines
Diff to previous 1.36 (colored)

indent: manually fix indentation in indent's own source code

Revision 1.36 / (download) - annotate - [select for diffs], Sat Mar 13 09:21:57 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.35: +24 -8 lines
Diff to previous 1.35 (colored)

indent: add debug logging for actually writing to the output file

Together with the results of the tokenizer and the 4 buffers for token,
label, code and comment, the debug log now provides a good high-level
view on how the indentation happens and where to look for the many
remaining bugs.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Mar 13 09:06:12 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.34: +3 -15 lines
Diff to previous 1.34 (colored)

indent: remove strange debugging code that went in the output file

Whenever the code to be output contained the magic byte 0x80, instead of
writing this byte, indent wrote the column number at the beginning of
the code snippet, times 7.  Especially the 'times 7' does not make any
sense at all.

In ISO-8859-1, this character position is not assigned.  In Microsoft
Codepage 1252 it is the Euro sign.  In UTF-8 (which was probably not on
the author's list when the code was originally written) it occurs as the
middle byte for code points like U+2026 (horizontal ellipsis) from the
block General Punctuation.

Remove this strange code, thereby fixing indent for UTF-8 code.  The
code had been there since at least 1993-04-09, when it was first
imported to NetBSD.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Mar 13 00:26:56 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.33: +30 -44 lines
Diff to previous 1.33 (colored)

indent: replace pad_output with output_indent

Calculating the indentation is simpler than calculating the column,
since that saves the constant addition and subtraction of the 1.

No functional change.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Mar 13 00:03:29 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.32: +4 -51 lines
Diff to previous 1.32 (colored)

indent: clean up verbose documentation comments from the 1970s

Since C90, there is no need to repeat the type of the function
parameters.

In the whole code of indent, there is a lot of confusion between the
concepts of a 'column' (which is a position on the screen, counting
starts at 1) and 'indentation' (which is a length, not a position).  To
avoid this confusion, the code will be rewritten anyway very soon.

Repeatedly adding and subtracting 1 from the 'current column' is not
elegant, this should rather be done by consistently measuring only the
indentation from the left border (at offset 0), as a distance, not as an
absolute position.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Mar 12 23:27:41 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.31: +12 -14 lines
Diff to previous 1.31 (colored)

indent: add 'const', rename variables, reorder formula for tab width

Column counting starts at 1.  This 1 should rather be at the beginning
of the formula since it is thought of being added at the very beginning
of the line, not at the end.

When adding a tab, the newly added tab is added at the end of the
string, therefore that '+ 1' should be at the end of the formula as
well.

No functional change.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Mar 12 23:16:00 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.30: +10 -10 lines
Diff to previous 1.30 (colored)

indent: replace 'target' with 'indent' in function names

The word 'target' was not as specific as possible.

No functional change.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Mar 12 23:10:18 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.29: +11 -16 lines
Diff to previous 1.29 (colored)

indent: use consistent indentation for 'else'

Half of the code used -ce, the other half the opposite -nce.

No functional change.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Mar 12 19:14:18 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (colored)

indent: make output_string inline

GCC 9.3.0 didn't notice that the argument to this function is always a
string literal, which makes it worthwhile to inline the call.

Revision 1.28 / (download) - annotate - [select for diffs], Fri Mar 12 19:11:29 2021 UTC (22 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.27: +52 -21 lines
Diff to previous 1.27 (colored)

indent: add helper functions for doing the actual output

This allows to add debug logging to these few functions instead of all
other places that might output something.

Reducing the possible output formats to a few primitives makes dump_line
simpler, especially the fprintf calls.  It also removes the non-constant
printf string.

The call to output_int may be meant for debugging, as the character 0x80
is unlikely to appear in any real-world code.

No functional change.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Mar 8 22:28:31 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.26: +3 -4 lines
Diff to previous 1.26 (colored)

indent: remove redundant initializer in dump_line

No functional change.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Mar 8 22:26:17 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.25: +8 -7 lines
Diff to previous 1.25 (colored)

indent: move comment about dump_line to column 1

It looked misplaced on the right side since that area is usually
reserved for small remarks, not long explanations.

No functional change.

Revision 1.25 / (download) - annotate - [select for diffs], Mon Mar 8 22:23:58 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.24: +7 -6 lines
Diff to previous 1.24 (colored)

indent: always use braces in do-while loops

Having a 'while' at the beginning of a line looks as if it would start a
loop.  It's confusing when it _ends_ a loop instead.

Revision 1.24 / (download) - annotate - [select for diffs], Sun Mar 7 22:11:01 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.23: +7 -2 lines
Diff to previous 1.23 (colored)

indent: fix handling of '//' end-of-line comments

Revision 1.23 / (download) - annotate - [select for diffs], Sun Mar 7 20:47:13 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.22: +6 -6 lines
Diff to previous 1.22 (colored)

indent: remove redundant parentheses around return value

No functional change.

Revision 1.22 / (download) - annotate - [select for diffs], Sun Mar 7 10:42:48 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

indent: use all headers in all files

This is a prerequisite for converting the token types to an enum instead
of a preprocessor define, since the return type of lexi will become
token_type.  Having the enum will make debugging easier.

There was a single naming collision, which forced the variable in
scan_profile to be renamed.  All other token names are used nowhere
else.

No change to the resulting binary.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Mar 6 20:30:06 2021 UTC (22 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.20: +5 -5 lines
Diff to previous 1.20 (colored)

indent: fix space-tab alignment in indent's own code

These parts are not fixed automatically by indent since they are in box
comments.

No functional change.

Revision 1.17.16.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:43 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.17.16.1: +16 -43 lines
Diff to previous 1.17.16.1 (colored) to branchpoint 1.17 (colored) next main 1.18 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.20 / (download) - annotate - [select for diffs], Sat Oct 19 15:44:31 2019 UTC (3 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp
Changes since 1.19: +16 -43 lines
Diff to previous 1.19 (colored)

use stdarg, annotate function as __printflike and fix broken formats.

Revision 1.17.16.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:10:20 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.17: +358 -509 lines
Diff to previous 1.17 (colored)

Sync with HEAD

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Thu Apr 4 20:39:17 2019 UTC (3 years, 9 months ago) by kamil
Branch: FREEBSD, CSRG
CVS Tags: r340138
Changes since 1.1.1.1: +175 -272 lines
Diff to previous 1.1.1.1 (colored)

FreeBSD indent r340138

Revision 1.19 / (download) - annotate - [select for diffs], Thu Apr 4 15:22:13 2019 UTC (3 years, 9 months ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Changes since 1.18: +358 -510 lines
Diff to previous 1.18 (colored)

Upgrade indent(1)

Merge all the changes from the recent FreeBSD HEAD snapshot
into our local copy.

FreeBSD actively maintains this program in their sources and their
repository contains over 100 commits with changes.

Keep the delta between the FreeBSD and NetBSD versions to absolute
minimum, mostly RCS Id and compatiblity fixes.

Major chages in this import:

 - Added an option -ldi<N> to control indentation of local variable names.
 - Added option -P for loading user-provided files as profiles
 - Added -tsn for setting tabsize
 - Rename -nsac/-sac ("space after cast") to -ncs/-cs
 - Added option -fbs Enables (disables) splitting the function declaration and opening brace across two lines.
 - Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)
 - Group global option variables into an options structure
 - Use bsearch() for looking up type keywords.
 - Don't produce unneeded space character in function declarators
 - Don't unnecessarily add a blank before a comment ends.
 - Don't ignore newlines after comments that follow braces.

Merge the FreeBSD intend(1) tests with our ATF framework.
All tests pass.

Upgrade prepared by Manikishan Ghantasala.
Final polishing by myself.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Feb 3 03:19:29 2019 UTC (3 years, 11 months ago) by mrg
Branch: MAIN
Changes since 1.17: +3 -2 lines
Diff to previous 1.17 (colored)

- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily

Revision 1.17 / (download) - annotate - [select for diffs], Thu Feb 25 13:23:27 2016 UTC (6 years, 11 months ago) by ginsbach
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi
Changes since 1.16: +5 -5 lines
Diff to previous 1.16 (colored)

Fix obvious contraction spelling mistakes by adding missing apostrophes.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Feb 22 19:04:18 2016 UTC (6 years, 11 months ago) by ginsbach
Branch: MAIN
Changes since 1.15: +3 -4 lines
Diff to previous 1.15 (colored)

Use errx(3).

Revision 1.14.24.1 / (download) - annotate - [select for diffs], Sun Sep 21 18:58:56 2014 UTC (8 years, 4 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.14: +7 -5 lines
Diff to previous 1.14 (colored) next main 1.15 (colored)

Pull up following revision(s) (requested by mrg in ticket #110):
	usr.bin/indent/io.c: revision 1.15
	usr.bin/indent/indent_globs.h: revision 1.10
	usr.bin/indent/args.c: revision 1.11
	usr.bin/indent/indent.1: revision 1.23
	usr.bin/indent/indent.c: revision 1.19
port the -ut / -nut options from freebsd.  -ut (default) enables tabs
in output, the -nut uses spaces.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Sep 4 04:06:07 2014 UTC (8 years, 4 months ago) by mrg
Branch: MAIN
Changes since 1.14: +7 -5 lines
Diff to previous 1.14 (colored)

port the -ut / -nut options from freebsd.  -ut (default) enables tabs
in output, the -nut uses spaces.

Revision 1.13.42.1 / (download) - annotate - [select for diffs], Wed May 13 19:19:52 2009 UTC (13 years, 8 months ago) by jym
Branch: jym-xensuspend
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored) next main 1.14 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.14 / (download) - annotate - [select for diffs], Sun Apr 12 11:09:49 2009 UTC (13 years, 9 months ago) by lukem
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, jym-xensuspend-nbase, jym-xensuspend-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: netbsd-7
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare)

Revision 1.13 / (download) - annotate - [select for diffs], Thu Oct 16 06:51:22 2003 UTC (19 years, 3 months ago) by itojun
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, mjf-devfs2-base, mjf-devfs2, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: jym-xensuspend
Changes since 1.12: +6 -4 lines
Diff to previous 1.12 (colored)

safer use of realloc

Revision 1.12 / (download) - annotate - [select for diffs], Thu Aug 7 11:14:09 2003 UTC (19 years, 5 months ago) by agc
Branch: MAIN
Changes since 1.11: +29 -2 lines
Diff to previous 1.11 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.

Revision 1.11 / (download) - annotate - [select for diffs], Sun May 26 22:53:38 2002 UTC (20 years, 8 months ago) by wiz
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.10: +14 -42 lines
Diff to previous 1.10 (colored)

Remove #ifndef'd __STDC__ code. ANSIfy.

Revision 1.9.2.1 / (download) - annotate - [select for diffs], Thu Oct 19 14:48:53 2000 UTC (22 years, 3 months ago) by he
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored) next main 1.10 (colored)

Pull up revision 1.10 (requested by is):
  The type of the difference between pointers is implementation-
  defined (long on sparc and int on most others).  Compensate when
  printing.

Revision 1.9.10.1 / (download) - annotate - [select for diffs], Tue Oct 17 02:16:44 2000 UTC (22 years, 3 months ago) by tv
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored) next main 1.10 (colored)

Pullup 1.10 [is]:
Due to infinite wisdom by the language designers, the difference of pointers
has a type of (int) on i386 and (long) on sparc, and I don't even want to
know what else on other cpu types.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Oct 14 18:07:10 2000 UTC (22 years, 3 months ago) by is
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

Due to infinite wisdom by the language designers, the difference of pointers
has a type of (int) on i386 and (long) on sparc, and I don't even want to
know what else on other cpu types.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Dec 19 17:00:08 1998 UTC (24 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-5-base, netbsd-1-5-ALPHA2, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, minoura-xpg4dl-base, minoura-xpg4dl, comdex-fall-1999-base, comdex-fall-1999
Branch point for: netbsd-1-5, netbsd-1-4
Changes since 1.8: +8 -8 lines
Diff to previous 1.8 (colored)

char -> unsigned char, braces for gcc-2.8.1

Revision 1.8 / (download) - annotate - [select for diffs], Tue Aug 25 20:59:37 1998 UTC (24 years, 5 months ago) by ross
Branch: MAIN
Changes since 1.7: +27 -11 lines
Diff to previous 1.7 (colored)

Add { and } to shut up egcs. Reformat the more questionable code.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Mar 30 02:25:33 1998 UTC (24 years, 10 months ago) by mrg
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

use static int instead of static

Revision 1.6 / (download) - annotate - [select for diffs], Sun Oct 19 14:06:35 1997 UTC (25 years, 3 months ago) by mrg
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

fix compile warnings on the alpha.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Oct 19 03:17:23 1997 UTC (25 years, 3 months ago) by lukem
Branch: MAIN
Changes since 1.4: +503 -467 lines
Diff to previous 1.4 (colored)

WARNSify, fix .Nm usage, deprecate register, use <err.h>, KNFify (with indent!;)

Revision 1.4 / (download) - annotate - [select for diffs], Sat Oct 18 16:04:45 1997 UTC (25 years, 3 months ago) by mrg
Branch: MAIN
Changes since 1.3: +9 -5 lines
Diff to previous 1.3 (colored)

merge lite-2.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jan 9 20:20:15 1997 UTC (26 years ago) by tls
Branch: MAIN
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

RCS ID police

Revision 1.2 / (download) - annotate - [select for diffs], Sun Aug 1 18:14:32 1993 UTC (29 years, 6 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-PATCH001, netbsd-1-2-BETA, netbsd-1-2, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1, netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

Add RCS identifiers.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sun Jun 6 21:52:29 1993 UTC (29 years, 7 months ago) by mrg
Branch: FREEBSD, CSRG
CVS Tags: lite-2
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

4.4BSD-Lite2

Revision 1.1 / (download) - annotate - [select for diffs], Fri Apr 9 12:59:14 1993 UTC (29 years, 9 months ago) by cgd
Branch: MAIN
CVS Tags: netbsd-alpha-1, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, netbsd-0-8

added, from net/2 (patch 124).

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>