The NetBSD Project

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

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

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.390: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:44:42 2023 UTC (11 months ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.389: preferred, colored
Changes since revision 1.389: +21 -21 lines
indent: inline input-related macros

No binary change.

Revision 1.389: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:40:44 2023 UTC (11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.388: preferred, colored
Changes since revision 1.388: +2 -3 lines
indent: group input-related variables into a struct

No functional change.

Revision 1.388: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:03:58 2023 UTC (11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.387: preferred, colored
Changes since revision 1.387: +6 -6 lines
indent: use line number of the token start in diagnostics

Previously, the line number of the end of the token was used, which was
confusing in debug mode.

Revision 1.387: download - view: text, markup, annotated - select for diffs
Tue Jun 27 04:41:23 2023 UTC (16 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.386: preferred, colored
Changes since revision 1.386: +3 -3 lines
indent: fix 'blank line above first statement in function body'

Revision 1.386: download - view: text, markup, annotated - select for diffs
Mon Jun 26 20:03:09 2023 UTC (16 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.385: preferred, colored
Changes since revision 1.385: +20 -2 lines
indent: implement 'blank line above first statement in function body'

Revision 1.385: download - view: text, markup, annotated - select for diffs
Mon Jun 26 14:54:40 2023 UTC (16 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.384: preferred, colored
Changes since revision 1.384: +4 -2 lines
indent: in -bad mode, don't add a blank line above a comment or '}'

Revision 1.384: download - view: text, markup, annotated - select for diffs
Sun Jun 25 19:35:45 2023 UTC (16 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.383: preferred, colored
Changes since revision 1.383: +6 -2 lines
indent: move cast detection from the lexer to the main processor

It is not the job of the lexer to modify the parser state.

Revision 1.383: download - view: text, markup, annotated - select for diffs
Sun Jun 25 19:19:42 2023 UTC (16 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.382: preferred, colored
Changes since revision 1.382: +4 -3 lines
indent: fix formatting of parenthesized name in function definition

Revision 1.382: download - view: text, markup, annotated - select for diffs
Fri Jun 23 20:43:21 2023 UTC (16 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.381: preferred, colored
Changes since revision 1.381: +4 -4 lines
indent: properly store parser state in debug mode

The stacks in the parser state are allocated now and need to be copied
individually.

The test whether two paren stacks are equal was broken since 2023-06-14
14:11:28.

Revision 1.381: download - view: text, markup, annotated - select for diffs
Sun Jun 18 07:10:24 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.380: preferred, colored
Changes since revision 1.380: +2 -4 lines
indent: remove support for backspace in code and comments

The C code in the whole tree does not contain a single literal
backspace.

Revision 1.380: download - view: text, markup, annotated - select for diffs
Sat Jun 17 22:28:49 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.379: preferred, colored
Changes since revision 1.379: +7 -7 lines
indent: miscellaneous cleanups

No binary change.

Revision 1.379: download - view: text, markup, annotated - select for diffs
Fri Jun 16 23:51:32 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.378: preferred, colored
Changes since revision 1.378: +9 -8 lines
indent: merge lexer symbols for type in/outside parentheses

Revision 1.378: download - view: text, markup, annotated - select for diffs
Fri Jun 16 23:07:52 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.377: preferred, colored
Changes since revision 1.377: +8 -7 lines
indent: fix spacing between postfix operator and left parenthesis

Revision 1.377: download - view: text, markup, annotated - select for diffs
Fri Jun 16 14:26:26 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.376: preferred, colored
Changes since revision 1.376: +6 -4 lines
indent: improve heuristics for cast expressions

Revision 1.376: download - view: text, markup, annotated - select for diffs
Fri Jun 16 14:12:10 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.375: preferred, colored
Changes since revision 1.375: +17 -8 lines
indent: improve heuristics for cast expressions

Revision 1.375: download - view: text, markup, annotated - select for diffs
Fri Jun 16 12:55:57 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.374: preferred, colored
Changes since revision 1.374: +4 -2 lines
indent: improve heuristics for casts

Revision 1.374: download - view: text, markup, annotated - select for diffs
Fri Jun 16 12:30:45 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.373: preferred, colored
Changes since revision 1.373: +10 -6 lines
indent: fix indentation and linebreaks in typedef declarations

Revision 1.373: download - view: text, markup, annotated - select for diffs
Fri Jun 16 11:48:32 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.372: preferred, colored
Changes since revision 1.372: +7 -5 lines
indent: don't force a blank line between '}' and preprocessing line

Revision 1.372: download - view: text, markup, annotated - select for diffs
Thu Jun 15 11:27:36 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.371: preferred, colored
Changes since revision 1.371: +2 -8 lines
indent: consolidate handling of statement continuations

Revision 1.371: download - view: text, markup, annotated - select for diffs
Thu Jun 15 10:59:06 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.370: preferred, colored
Changes since revision 1.370: +6 -7 lines
indent: rename state variable to be more accurate

No binary change.

Revision 1.370: download - view: text, markup, annotated - select for diffs
Thu Jun 15 10:34:12 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.369: preferred, colored
Changes since revision 1.369: +8 -2 lines
indent: fix indentation of multi-line enum constant initializers

Revision 1.369: download - view: text, markup, annotated - select for diffs
Thu Jun 15 09:19:06 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.368: preferred, colored
Changes since revision 1.368: +23 -26 lines
indent: miscellaneous cleanups, more tests for edge cases

Revision 1.368: download - view: text, markup, annotated - select for diffs
Thu Jun 15 08:40:20 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.367: preferred, colored
Changes since revision 1.367: +4 -3 lines
indent: fix alignment of multi-line declarations

Revision 1.367: download - view: text, markup, annotated - select for diffs
Wed Jun 14 20:46:08 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.366: preferred, colored
Changes since revision 1.366: +45 -50 lines
indent: clean up the code, add a few tests

Revision 1.366: download - view: text, markup, annotated - select for diffs
Wed Jun 14 19:05:40 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.365: preferred, colored
Changes since revision 1.365: +36 -17 lines
indent: allow more than 128 brace levels

Revision 1.365: download - view: text, markup, annotated - select for diffs
Wed Jun 14 16:14:30 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.364: preferred, colored
Changes since revision 1.364: +10 -10 lines
indent: clean up array indexing for parser symbols

With 'top' pointing to the actual top element, the array was indexed in
the closed range from 0 to top. All other arrays are indexed by the
usual half-open interval from 0 to len.

No functional change.

Revision 1.364: download - view: text, markup, annotated - select for diffs
Wed Jun 14 14:11:28 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.363: preferred, colored
Changes since revision 1.363: +69 -46 lines
indent: allow more than 20 nested parentheses or brackets

Revision 1.363: download - view: text, markup, annotated - select for diffs
Wed Jun 14 13:15:30 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.362: preferred, colored
Changes since revision 1.362: +13 -15 lines
indent: merge duplicate code

Revision 1.362: download - view: text, markup, annotated - select for diffs
Wed Jun 14 11:18:09 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.361: preferred, colored
Changes since revision 1.361: +4 -3 lines
indent: fix formatting of comment after 'switch (expr)'

Revision 1.361: download - view: text, markup, annotated - select for diffs
Wed Jun 14 10:29:52 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.360: preferred, colored
Changes since revision 1.360: +3 -4 lines
indent: use correct preprocessing directive in error message

Revision 1.360: download - view: text, markup, annotated - select for diffs
Wed Jun 14 10:26:00 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.359: preferred, colored
Changes since revision 1.359: +17 -12 lines
indent: allow more than 5 levels of #if/#endif

Revision 1.359: download - view: text, markup, annotated - select for diffs
Wed Jun 14 08:36:51 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.358: preferred, colored
Changes since revision 1.358: +2 -3 lines
indent: remove another flag from parser state

When processing a comment, the flag ps.next_col_1 was not used for the
next token, but for a line within a comment.  As its scope was limited
to a single comment, there is no need to store it any longer than that

No functional change.

Revision 1.358: download - view: text, markup, annotated - select for diffs
Wed Jun 14 07:20:55 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.357: preferred, colored
Changes since revision 1.357: +3 -3 lines
indent: merge parser symbols for stmt and stmt_list

They were handled in exactly the same way.

Revision 1.357: download - view: text, markup, annotated - select for diffs
Sat Jun 10 21:36:38 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.356: preferred, colored
Changes since revision 1.356: +8 -8 lines
indent: rename misleading variable

The name started with 'line_start', but the value is not always the
value from the beginning of the line.

No functional change.

Revision 1.356: download - view: text, markup, annotated - select for diffs
Sat Jun 10 20:37:12 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.355: preferred, colored
Changes since revision 1.355: +4 -4 lines
indent: fix debug output

When the parser state was first printed, there were unintended diff
markers.  Treat the previous lexer symbol like the other parts of the
parser state, as omitting it from the diff output is confusing.

Revision 1.355: download - view: text, markup, annotated - select for diffs
Sat Jun 10 18:46:42 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.354: preferred, colored
Changes since revision 1.354: +14 -14 lines
indent: fix line break between semicolon and brace

Revision 1.354: download - view: text, markup, annotated - select for diffs
Sat Jun 10 16:43:55 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.353: preferred, colored
Changes since revision 1.353: +41 -44 lines
indent: miscellaneous cleanups

Revision 1.353: download - view: text, markup, annotated - select for diffs
Sat Jun 10 12:59:31 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.352: preferred, colored
Changes since revision 1.352: +17 -4 lines
indent: in debug mode, null-terminate buffers

Revision 1.352: download - view: text, markup, annotated - select for diffs
Sat Jun 10 08:17:04 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.351: preferred, colored
Changes since revision 1.351: +4 -19 lines
indent: fix indentation of continuation lines in initializers

Revision 1.351: download - view: text, markup, annotated - select for diffs
Sat Jun 10 07:42:41 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.350: preferred, colored
Changes since revision 1.350: +14 -20 lines
indent: clean up function and variable names

Revision 1.350: download - view: text, markup, annotated - select for diffs
Sat Jun 10 06:52:35 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.349: preferred, colored
Changes since revision 1.349: +5 -6 lines
indent: fix token classification in declarations

As a side effect, indent handles _Generic from C11 properly now, at
least in -nlp mode.

Revision 1.349: download - view: text, markup, annotated - select for diffs
Sat Jun 10 06:38:21 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.348: preferred, colored
Changes since revision 1.348: +35 -35 lines
indent: rename and sort variables in parser state

No functional change.

Revision 1.348: download - view: text, markup, annotated - select for diffs
Fri Jun 9 22:01:26 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.347: preferred, colored
Changes since revision 1.347: +3 -10 lines
indent: trim trailing blank lines

Revision 1.347: download - view: text, markup, annotated - select for diffs
Fri Jun 9 16:23:43 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.346: preferred, colored
Changes since revision 1.346: +320 -320 lines
indent: group lexer symbols by topic, sort processing functions

No functional change.

Revision 1.346: download - view: text, markup, annotated - select for diffs
Fri Jun 9 11:22:31 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.345: preferred, colored
Changes since revision 1.345: +4 -4 lines
indent: support C99 compound literals

Revision 1.345: download - view: text, markup, annotated - select for diffs
Fri Jun 9 10:24:55 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.344: preferred, colored
Changes since revision 1.344: +5 -8 lines
indent: don't treat function call expressions as cast expressions

Revision 1.344: download - view: text, markup, annotated - select for diffs
Fri Jun 9 08:16:06 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.343: preferred, colored
Changes since revision 1.343: +6 -10 lines
indent: eliminate unused variable

No functional change.

Revision 1.343: download - view: text, markup, annotated - select for diffs
Fri Jun 9 08:10:58 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.342: preferred, colored
Changes since revision 1.342: +5 -10 lines
indent: when an indentation is ambiguous, indent one level further

The '-eei' mode now applies whenever the indentation from a multi-line
expression could be confused with a following statement.

Revision 1.342: download - view: text, markup, annotated - select for diffs
Fri Jun 9 07:20:30 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.341: preferred, colored
Changes since revision 1.341: +6 -6 lines
indent: format its own code

Revision 1.341: download - view: text, markup, annotated - select for diffs
Thu Jun 8 21:18:54 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.340: preferred, colored
Changes since revision 1.340: +2 -22 lines
indent: remove fragile heuristic for detecting cast expressions

The assumption that in an expression of the form '(a * anything)', the
'*' marks a pointer type was too simple-minded.

For now, fix the obvious cases and leave the others for later.  If
needed, they can be worked around using the '-T' option.

Revision 1.340: download - view: text, markup, annotated - select for diffs
Thu Jun 8 20:55:22 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.339: preferred, colored
Changes since revision 1.339: +4 -3 lines
indent: fix indentation of initializer lists with designators

Revision 1.339: download - view: text, markup, annotated - select for diffs
Thu Jun 8 06:47:13 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.338: preferred, colored
Changes since revision 1.338: +61 -191 lines
indent: clean up and condense code

No functional change.

Revision 1.338: download - view: text, markup, annotated - select for diffs
Wed Jun 7 15:46:11 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.337: preferred, colored
Changes since revision 1.337: +13 -12 lines
indent: extract the stack of parser symbols to a separate struct

No functional change.

Revision 1.337: download - view: text, markup, annotated - select for diffs
Tue Jun 6 04:37:26 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.336: preferred, colored
Changes since revision 1.336: +2 -3 lines
indent: compute indentation of 'case' labels on-demand

One less moving part to keep track of.

No functional change.

Revision 1.336: download - view: text, markup, annotated - select for diffs
Mon Jun 5 20:56:18 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.335: preferred, colored
Changes since revision 1.335: +8 -3 lines
indent: in 'if (expr)', the parentheses do not form a cast expression

No functional change.  When stepping through the code in debug mode, it
was just too confusing that indent would log an 'unknown cast' in this
situation.

Revision 1.335: download - view: text, markup, annotated - select for diffs
Mon Jun 5 12:05:01 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.334: preferred, colored
Changes since revision 1.334: +4 -4 lines
indent: format own source code

Revision 1.334: download - view: text, markup, annotated - select for diffs
Mon Jun 5 12:01:33 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.333: preferred, colored
Changes since revision 1.333: +7 -2 lines
indent: don't remove blank line after 'if (expr) {'

Revision 1.333: download - view: text, markup, annotated - select for diffs
Mon Jun 5 10:12:21 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.332: preferred, colored
Changes since revision 1.332: +5 -16 lines
indent: do not report broken lines, report configuration on stderr

Revision 1.332: download - view: text, markup, annotated - select for diffs
Mon Jun 5 09:41:40 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.331: preferred, colored
Changes since revision 1.331: +3 -2 lines
indent: fix formatting of 'do' statements

Revision 1.331: download - view: text, markup, annotated - select for diffs
Mon Jun 5 09:10:31 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.330: preferred, colored
Changes since revision 1.330: +16 -34 lines
indent: make heuristics for '*' pointer types simpler

Previously, a '}' token did not reset the state machine, but it should.

Revision 1.330: download - view: text, markup, annotated - select for diffs
Mon Jun 5 08:22:00 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.329: preferred, colored
Changes since revision 1.329: +3 -5 lines
indent: fix trailing whitespace after comment

Revision 1.329: download - view: text, markup, annotated - select for diffs
Mon Jun 5 07:35:05 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.328: preferred, colored
Changes since revision 1.328: +6 -8 lines
indent: rename variables, clean up comments

No binary change.

Revision 1.328: download - view: text, markup, annotated - select for diffs
Mon Jun 5 07:23:03 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.327: preferred, colored
Changes since revision 1.327: +2 -5 lines
indent: clean up handling of whitespace

No functional change.

Revision 1.327: download - view: text, markup, annotated - select for diffs
Sun Jun 4 20:51:19 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.326: preferred, colored
Changes since revision 1.326: +38 -39 lines
indent: remove read pointer from buffers that don't need it

The only buffer that needs a read pointer is the current input line in
'inp'.

No functional change.

Revision 1.326: download - view: text, markup, annotated - select for diffs
Sun Jun 4 17:54:11 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.325: preferred, colored
Changes since revision 1.325: +14 -30 lines
indent: track the kind of '{' on the parser stack

Revision 1.325: download - view: text, markup, annotated - select for diffs
Sun Jun 4 14:38:15 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.324: preferred, colored
Changes since revision 1.324: +5 -6 lines
indent: ensure that the 'block init level' never goes negative

No functional change.

Revision 1.324: download - view: text, markup, annotated - select for diffs
Sun Jun 4 14:20:00 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.323: preferred, colored
Changes since revision 1.323: +19 -19 lines
indent: rename struct field, for better symmetry

No binary change outside debug mode.

Revision 1.323: download - view: text, markup, annotated - select for diffs
Sun Jun 4 13:26:06 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.322: preferred, colored
Changes since revision 1.322: +11 -2 lines
indent: fix formatting of compound expressions, at least partially

Revision 1.322: download - view: text, markup, annotated - select for diffs
Sun Jun 4 12:46:57 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.321: preferred, colored
Changes since revision 1.321: +4 -3 lines
lint: use separate lexer symbols for 'case' and 'default'

It's not strictly necessary since these tokens behave in the same way,
still, the code is more straight-forward when there are separate tokens.

Revision 1.321: download - view: text, markup, annotated - select for diffs
Sun Jun 4 11:45:00 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.320: preferred, colored
Changes since revision 1.320: +4 -4 lines
indent: classify 'inline' as a modifier rather than a word

Revision 1.320: download - view: text, markup, annotated - select for diffs
Sun Jun 4 11:33:36 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.319: preferred, colored
Changes since revision 1.319: +33 -25 lines
indent: use separate lexer symbols for the different kinds of ':'

Revision 1.319: download - view: text, markup, annotated - select for diffs
Sun Jun 4 11:09:18 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.318: preferred, colored
Changes since revision 1.318: +4 -5 lines
indent: handle the indentation of 'case' in a simpler way

Revision 1.318: download - view: text, markup, annotated - select for diffs
Sun Jun 4 10:23:36 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.317: preferred, colored
Changes since revision 1.317: +76 -33 lines
indent: separate code for handling parentheses and brackets

Handling parentheses is more complicated than for brackets.

Revision 1.317: download - view: text, markup, annotated - select for diffs
Sat Jun 3 21:44:08 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.316: preferred, colored
Changes since revision 1.316: +4 -3 lines
indent: fix indentation of adjacent '{'

Revision 1.316: download - view: text, markup, annotated - select for diffs
Sat Jun 3 21:24:26 2023 UTC (17 months ago) by rillig
Branches: MAIN
Diff to: previous 1.315: preferred, colored
Changes since revision 1.315: +4 -4 lines
indent: clean up handling of brace indentation

No functional change.

Revision 1.315: download - view: text, markup, annotated - select for diffs
Fri Jun 2 15:07:46 2023 UTC (17 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.314: preferred, colored
Changes since revision 1.314: +7 -2 lines
indent: force each statement on a new line

Previously, '{} while (cond)' was kept on a single line, even though the
'while' was independent of the '{}'.

Revision 1.314: download - view: text, markup, annotated - select for diffs
Fri Jun 2 14:34:14 2023 UTC (17 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.313: preferred, colored
Changes since revision 1.313: +6 -2 lines
indent: remove newline between 'switch' and '{'

Revision 1.313: download - view: text, markup, annotated - select for diffs
Fri Jun 2 14:21:55 2023 UTC (17 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.312: preferred, colored
Changes since revision 1.312: +4 -4 lines
indent: improve heuristics of classifying '*' as pointer or operator

Revision 1.312: download - view: text, markup, annotated - select for diffs
Fri Jun 2 13:59:33 2023 UTC (17 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.311: preferred, colored
Changes since revision 1.311: +9 -9 lines
indent: clean up

Only print the 'token' buffer in debug mode if it is interesting, group
the blocks in handling of '(' tokens by topic, remove obsolete comment
from test.

Revision 1.311: download - view: text, markup, annotated - select for diffs
Fri Jun 2 11:43:07 2023 UTC (17 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.310: preferred, colored
Changes since revision 1.310: +8 -7 lines
indent: fix formatting of declarations with preprocessing lines

Revision 1.310: download - view: text, markup, annotated - select for diffs
Tue May 23 18:16:28 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.309: preferred, colored
Changes since revision 1.309: +37 -5 lines
indent: separate code for handling enums from the lexer

The lexer's responsibility is to generate tokens, it's not supposed to
update the parser state.  Centralize the state transitions that control
indentation of enum constants to keep the lexer code clean.

Skip comments, newlines and preprocessing lines when updating the parser
state for enum constants and for '*' in declarations.

Revision 1.309: download - view: text, markup, annotated - select for diffs
Tue May 23 16:53:57 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +3 -2 lines
indent: fix indentation of struct declarations

Revision 1.308: download - view: text, markup, annotated - select for diffs
Tue May 23 12:12:29 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.307: preferred, colored
Changes since revision 1.307: +11 -2 lines
indent: split debug output into paragraphs

The paragraphs separate the different processing steps: getting a token
from the lexer, processing the token, updating the parser state, sending
a finished line to the output.

Revision 1.307: download - view: text, markup, annotated - select for diffs
Tue May 23 11:37:23 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.306: preferred, colored
Changes since revision 1.306: +128 -122 lines
indent: extract processing of a single token to separate function

No functional change.

Revision 1.306: download - view: text, markup, annotated - select for diffs
Tue May 23 06:43:19 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.305: preferred, colored
Changes since revision 1.305: +4 -2 lines
indent: fix spacing around '*' in declarations

Revision 1.305: download - view: text, markup, annotated - select for diffs
Tue May 23 06:35:01 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.304: preferred, colored
Changes since revision 1.304: +40 -2 lines
indent: fix spacing in declarations in for loops

Revision 1.304: download - view: text, markup, annotated - select for diffs
Mon May 22 23:03:16 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.303: preferred, colored
Changes since revision 1.303: +4 -3 lines
indent: fix spacing between block braces

Revision 1.303: download - view: text, markup, annotated - select for diffs
Mon May 22 10:28:59 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.302: preferred, colored
Changes since revision 1.302: +3 -2 lines
indent: implement suppressing optional blank lines

Revision 1.302: download - view: text, markup, annotated - select for diffs
Sun May 21 10:05:20 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.301: preferred, colored
Changes since revision 1.301: +8 -8 lines
indent: don't read out-of-bounds memory in preprocessing lines

(Since a few minutes.)

If a line '#if 0' was followed by an unlikely line '#', the second line
was interpreted as '#if' as well.

To detect this bug automatically, a dynamic analysis tool would need to
know that only the memory between lab.mem and lab.mem + lab.len has
defined content.  This constraint, in turn, would throw up at the bottom
of copy_comment_wrap, which for a brief moment intentionally violates
this constraint.

Revision 1.301: download - view: text, markup, annotated - select for diffs
Sun May 21 09:48:22 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.300: preferred, colored
Changes since revision 1.300: +12 -45 lines
indent: don't error out on unrecognized preprocessor directives

This allows indent to be used on the GCC preprocessor output.

Revision 1.300: download - view: text, markup, annotated - select for diffs
Sat May 20 16:31:31 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.299: preferred, colored
Changes since revision 1.299: +3 -3 lines
indent: remove redundant checks in processing of '}'

No functional change.

Revision 1.299: download - view: text, markup, annotated - select for diffs
Sat May 20 11:53:53 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.298: preferred, colored
Changes since revision 1.298: +5 -5 lines
indent: extract the output state from the parser state

The parser state depends on the preprocessing lines, the output state
shouldn't.

Revision 1.298: download - view: text, markup, annotated - select for diffs
Sat May 20 10:46:21 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.297: preferred, colored
Changes since revision 1.297: +5 -2 lines
indent: implement blank line after function body

Revision 1.297: download - view: text, markup, annotated - select for diffs
Sat May 20 10:09:02 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.296: preferred, colored
Changes since revision 1.296: +4 -2 lines
indent: implement blank lines around conditional compilation

Revision 1.296: download - view: text, markup, annotated - select for diffs
Sat May 20 02:47:35 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.295: preferred, colored
Changes since revision 1.295: +2 -5 lines
indent: add debug logging for brace indentation

No functional change outside debug mode, as the initialization of
di_stack[0] was redundant.

Revision 1.295: download - view: text, markup, annotated - select for diffs
Thu May 18 07:13:05 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.294: preferred, colored
Changes since revision 1.294: +3 -13 lines
indent: remove detailed rules for blank before comment

Revision 1.294: download - view: text, markup, annotated - select for diffs
Thu May 18 06:01:39 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +22 -21 lines
indent: rename a few functions

No functional change.

Revision 1.293: download - view: text, markup, annotated - select for diffs
Thu May 18 05:33:27 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.292: preferred, colored
Changes since revision 1.292: +24 -17 lines
indent: manually wrap overly long lines

No functional change.

Revision 1.292: download - view: text, markup, annotated - select for diffs
Thu May 18 04:23:03 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.291: preferred, colored
Changes since revision 1.291: +782 -781 lines
indent: switch to standard code style

Taken from share/misc/indent.pro.

Indent does not wrap code to fit into the line width, it only does so
for comments.  The 'INDENT OFF' sections and too long lines will be
addressed in a follow-up commit.

No functional change.

Revision 1.291: download - view: text, markup, annotated - select for diffs
Thu May 18 03:38:34 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.290: preferred, colored
Changes since revision 1.290: +3 -3 lines
indent: remove unnecessary variable size optimization

Due to the enum that follows in the struct, the short variable was
padded to 4 bytes anyway.

No functional change.

Revision 1.290: download - view: text, markup, annotated - select for diffs
Tue May 16 13:26:26 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +10 -10 lines
indent: directly access the input buffer

No functional change.

Revision 1.289: download - view: text, markup, annotated - select for diffs
Tue May 16 11:32:01 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.288: preferred, colored
Changes since revision 1.288: +4 -16 lines
indent: remove support for form feed characters inside a line

Form feeds are occasionally used to split code into pages, and this use
is still supported.  Having a form feed in the middle of a line is
exotic.

Revision 1.288: download - view: text, markup, annotated - select for diffs
Tue May 16 08:22:11 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.287: preferred, colored
Changes since revision 1.287: +17 -6 lines
indent: remove blank between comment and parentheses or brackets

Finally, indent formats its own source code without messing up the
layout.

Revision 1.287: download - view: text, markup, annotated - select for diffs
Tue May 16 08:04:03 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.286: preferred, colored
Changes since revision 1.286: +9 -3 lines
indent: fix handling of INDENT OFF/ON comments

Previously, the 'INDENT OFF' comments were interpreted when the newline
token from the line above the comment was processed, which was earlier
than could be reasonably expected.

The 'INDENT ON' comments were interpreted equally early, which led to
the situation that the 'INDENT OFF' comments were preserved literally
but the 'INDENT ON' comments weren't.

Revision 1.286: download - view: text, markup, annotated - select for diffs
Mon May 15 22:52:21 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.285: preferred, colored
Changes since revision 1.285: +9 -12 lines
indent: clean up detection of whether parentheses form a cast

No functional change.

Revision 1.285: download - view: text, markup, annotated - select for diffs
Mon May 15 22:35:41 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.284: preferred, colored
Changes since revision 1.284: +20 -21 lines
indent: fix cast detection

In process_lparen_or_lbracket, ps.paren[...].maybe_cast was not
initialized, which may have been the cause for seemingly random spacing
around binary operators.

While here, clean up the code by reducing the number of accesses to the
parser state.

Revision 1.284: download - view: text, markup, annotated - select for diffs
Mon May 15 21:51:45 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.283: preferred, colored
Changes since revision 1.283: +3 -2 lines
indent: fix detection of casts

A word followed by a '(' does not start a cast expression.

Revision 1.283: download - view: text, markup, annotated - select for diffs
Mon May 15 20:50:37 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.282: preferred, colored
Changes since revision 1.282: +4 -3 lines
indent: fix type cast in function definition

Revision 1.282: download - view: text, markup, annotated - select for diffs
Mon May 15 20:30:20 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.281: preferred, colored
Changes since revision 1.281: +3 -3 lines
indent: fix duplicate space between comment and binary operator

Revision 1.281: download - view: text, markup, annotated - select for diffs
Mon May 15 20:12:28 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.280: preferred, colored
Changes since revision 1.280: +7 -6 lines
indent: format its own code, extend some comments

With manual corrections, as there are still some bugs left.

No functional change.

Revision 1.280: download - view: text, markup, annotated - select for diffs
Mon May 15 18:22:40 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.279: preferred, colored
Changes since revision 1.279: +16 -3 lines
indent: improve type guessing, fix formatting of declarations

Revision 1.279: download - view: text, markup, annotated - select for diffs
Mon May 15 14:55:47 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +5 -2 lines
indent: fix spacing between function prototype and attributes

Revision 1.278: download - view: text, markup, annotated - select for diffs
Mon May 15 14:12:03 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +5 -2 lines
indent: fix indentation of struct member names

Revision 1.277: download - view: text, markup, annotated - select for diffs
Mon May 15 13:37:16 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +12 -12 lines
indent: indent multi-line conditions

No functional change.

Revision 1.276: download - view: text, markup, annotated - select for diffs
Mon May 15 13:33:19 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +5 -4 lines
indent: fix indentation of statements after controlling expression

Revision 1.275: download - view: text, markup, annotated - select for diffs
Mon May 15 12:59:43 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +8 -2 lines
indent: fix indentation of expressions in -nlp -eei mode

Revision 1.274: download - view: text, markup, annotated - select for diffs
Mon May 15 10:13:40 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +12 -2 lines
indent: fix indentation of multi-line '?:' expressions in functions

Revision 1.273: download - view: text, markup, annotated - select for diffs
Mon May 15 09:22:53 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +6 -6 lines
indent: let indent format its own code

With manual corrections, as indent does not properly indent multi-line
'?:' expressions nor multi-line controlling expressions.

Revision 1.272: download - view: text, markup, annotated - select for diffs
Mon May 15 08:56:39 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +3 -2 lines
indent: fix spacing in for loop with declaration (since 2022-02-13)

Revision 1.271: download - view: text, markup, annotated - select for diffs
Mon May 15 08:11:27 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +2 -3 lines
indent: remove redundant include lines

Revision 1.270: download - view: text, markup, annotated - select for diffs
Mon May 15 08:02:01 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +4 -16 lines
indent: clean up memory allocation

No functional change.

Revision 1.269: download - view: text, markup, annotated - select for diffs
Mon May 15 07:57:22 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +2 -48 lines
indent: move debugging code to separate file

No functional change.

Revision 1.268: download - view: text, markup, annotated - select for diffs
Mon May 15 07:28:45 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +81 -130 lines
indent: clean up memory and buffer management

Remove the need to explicitly initialize the buffers.  To avoid
subtracting null pointers or comparing them using '<', migrate the
buffers from the (start, end) form to the (start, len) form.  This form
also avoids inconsistencies in whether 'buf.e == buf.s' or 'buf.s ==
buf.e' is used.

Make buffer.st const, to avoid accidental modification of the buffer's
content.

Replace '*buf.e++ = ch' with buf_add_char, to avoid having to keep track
how much unwritten space is left in the buffer.  Remove all safety
margins, that is, no more unchecked access to buf.st[-1] or appending
using '*buf.e++'.

Fix line number counting in lex_word for words that contain line breaks.

No functional change.

Revision 1.267: download - view: text, markup, annotated - select for diffs
Sun May 14 22:26:37 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +5 -20 lines
indent: only null-terminate the buffers if necessary

The only case where a buffer is used as a C-style string is when looking
up a keyword.

No functional change.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Sun May 14 12:12:02 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +2 -10 lines
indent: remove foreign RCS IDs

Revision 1.265: download - view: text, markup, annotated - select for diffs
Sun May 14 11:29:23 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +26 -29 lines
indent: miscellaneous cleanups

Revision 1.264: download - view: text, markup, annotated - select for diffs
Sat May 13 17:54:34 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +8 -4 lines
indent: prevent undefined behavior on unbalanced parentheses

Revision 1.263: download - view: text, markup, annotated - select for diffs
Sat May 13 17:20:41 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +8 -17 lines
indent: do not add a blank at the beginning of a line

Most calls to output_line did already reset the variable.  There may be
some untested edge cases in or after comments, but these should be fine
as well.

Revision 1.262: download - view: text, markup, annotated - select for diffs
Sat May 13 16:40:18 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +4 -3 lines
indent: do not add a space before a comment that starts a line

Revision 1.261: download - view: text, markup, annotated - select for diffs
Sat May 13 16:19:37 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +8 -10 lines
indent: replace __dead functions with return statements

No functional change.

Revision 1.260: download - view: text, markup, annotated - select for diffs
Sat May 13 14:30:48 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +7 -7 lines
indent: use enum instead of magic numbers for tracking declarations

No functional change.

Revision 1.259: download - view: text, markup, annotated - select for diffs
Sat May 13 12:31:02 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +12 -12 lines
indent: rename struct fields for buffers

No binary change except for assertion line numbers.

Revision 1.258: download - view: text, markup, annotated - select for diffs
Sat May 13 09:40:47 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +4 -5 lines
indent: clean up a condition, add comments

No functional change.

Revision 1.257: download - view: text, markup, annotated - select for diffs
Sat May 13 08:33:39 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +43 -14 lines
indent: preserve indentation of preprocessor directives

Revision 1.256: download - view: text, markup, annotated - select for diffs
Fri May 12 22:38:47 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +15 -15 lines
indent: rename placeholder symbol for parser stack

No functional change outside debug mode.

Revision 1.255: download - view: text, markup, annotated - select for diffs
Fri May 12 15:36:02 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +2 -7 lines
indent: remove code for parsing declarations without semicolon

The statement from the comment that declarations do not need semicolons
is wrong. A possible input that matched this rule is 'void f(void) { int
a }'.

Revision 1.254: download - view: text, markup, annotated - select for diffs
Fri May 12 10:53:33 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +2 -9 lines
indent: remove statistics

The numbers from the statistics were wrong.

Revision 1.253: download - view: text, markup, annotated - select for diffs
Fri May 12 08:40:54 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +24 -30 lines
indent: condense code for handling spaced expressions

No functional change outside debug mode.

Revision 1.252: download - view: text, markup, annotated - select for diffs
Thu May 11 19:01:35 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +2 -15 lines
indent: don't touch comments in preprocessing lines

The indentation of multi-line comments was wrong, and the code for
handling them was too complicated.

Revision 1.251: download - view: text, markup, annotated - select for diffs
Thu May 11 18:13:55 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +2 -23 lines
indent: remove broken code for handling blank lines

This fixes several bugs where blank lines were erroneously added or
removed, treating these old bugs for new bugs in different places.
These new bugs are expected to be easier to fix, as the old bugs will
not interfere anymore.

Revision 1.250: download - view: text, markup, annotated - select for diffs
Thu May 11 11:25:47 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +72 -91 lines
indent: move parser state variables to the parser_state struct

Include the variables in the debug output.

Revision 1.249: download - view: text, markup, annotated - select for diffs
Thu May 11 10:54:14 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +3 -6 lines
indent: eliminate a local variable for else-if handling

No functional change intended.

Revision 1.248: download - view: text, markup, annotated - select for diffs
Thu May 11 10:51:33 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +32 -36 lines
indent: move force_nl into the parser state

This way, it is included in the debug output.

No functional change.

Revision 1.247: download - view: text, markup, annotated - select for diffs
Thu May 11 10:39:25 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +8 -9 lines
indent: remove unnecessary assignments to last_else

No functional change intended.

Revision 1.246: download - view: text, markup, annotated - select for diffs
Thu May 11 09:28:53 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +5 -199 lines
indent: remove buggy code for swapping tokens

It is not the job of an indenter to swap tokens, even if it's only about
placing comments elsewhere.  The code that swapped the tokens was
complicated, buggy and impossible to understand.

In -br (brace right) mode, indent no longer moves a '{' from the
beginning of a line to the end of the previous line, as that was handled
by the token swapping code as well.  This change is unintended, but it
will be easier to re-add that now that the code is simpler.

Revision 1.245: download - view: text, markup, annotated - select for diffs
Mon May 9 21:41:49 2022 UTC (2 years, 6 months ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +2 -5 lines
indent: clean up control flow, remove Capsicum

No functional change.

Revision 1.244: download - view: text, markup, annotated - select for diffs
Sat Apr 23 06:43:22 2022 UTC (2 years, 6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +13 -15 lines
indent: group global variables related to output control

No functional change.

Revision 1.243: download - view: text, markup, annotated - select for diffs
Sat Apr 23 06:32:20 2022 UTC (2 years, 6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +2 -23 lines
indent: remove Capsicum support

NetBSD doesn't have Capsicum.

Revision 1.242: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:43:26 2022 UTC (2 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +32 -32 lines
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.241: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:20:09 2022 UTC (2 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +14 -15 lines
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.240: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:09:19 2022 UTC (2 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +8 -8 lines
indent: change parser_state.cast_mask to 0-based indexing

Having 1-based indexing was completely unexpected, and it didn't match
the 0-based indexing of parser_state.paren_indents.

No functional change.

Revision 1.239: download - view: text, markup, annotated - select for diffs
Sun Nov 28 14:29:03 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +2 -13 lines
indent: treat L"string" as a single token

There is never whitespace between the 'L' and the string literal or the
character constant. There might be a backslash-newline between them, but
that case was not handled before either.

No functional change.

Revision 1.238: download - view: text, markup, annotated - select for diffs
Sun Nov 28 11:49:10 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +3 -3 lines
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.237: download - view: text, markup, annotated - select for diffs
Sat Nov 27 21:15:58 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +4 -4 lines
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.236: download - view: text, markup, annotated - select for diffs
Sat Nov 27 18:37:17 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +14 -14 lines
indent: rename dump functions to output

No functional change.

Revision 1.235: download - view: text, markup, annotated - select for diffs
Sat Nov 27 18:29:29 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +9 -15 lines
indent: inline switch_buffer

The function name was not accurate all the time. Now that
inp_from_comment is a separate function, it doesn't make sense anymore
to offload the 3 simple statements to a separate function.

No functional change.

Revision 1.234: download - view: text, markup, annotated - select for diffs
Fri Nov 26 15:18:18 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +17 -11 lines
indent: add buf_add_range for adding characters to a buffer

No functional change.

Revision 1.233: download - view: text, markup, annotated - select for diffs
Fri Nov 26 14:17:01 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +22 -2 lines
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.232: download - view: text, markup, annotated - select for diffs
Thu Nov 25 18:48:37 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +9 -9 lines
indent: rename ps.in_function_parameters to match reality

This flag is only set while parsing the parameters of a function
definition, but not for a function declaration. See buffer_add in the
test fmt_decl.

No functional change.

Revision 1.231: download - view: text, markup, annotated - select for diffs
Thu Nov 25 07:45:32 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +13 -12 lines
indent: rename ps.in_stmt to in_stmt_or_decl

The previous name didn't match reality.

No functional change.

Revision 1.230: download - view: text, markup, annotated - select for diffs
Thu Nov 25 07:41:13 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +5 -5 lines
indent: rename ps.ind_stmt to in_stmt_cont

This makes a comment redundant.

No functional change.

Revision 1.229: download - view: text, markup, annotated - select for diffs
Thu Nov 25 07:30:54 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +5 -4 lines
indent: clean up style

No functional change.

Revision 1.228: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:23:17 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +3 -4 lines
indent: reduce casts to unsigned char for character classification

No functional change.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:04:02 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +3 -2 lines
indent: fix included headers

Revision 1.226: download - view: text, markup, annotated - select for diffs
Fri Nov 19 19:55:15 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +5 -5 lines
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.225: download - view: text, markup, annotated - select for diffs
Fri Nov 19 18:14:18 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +13 -35 lines
indent: remove all references to inbuf from indent.c

No functional change.

Revision 1.224: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:59:16 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +7 -36 lines
indent: move character input handling from indent.c to io.c

No functional change.

Revision 1.223: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:42:45 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +25 -82 lines
indent: move character input from indent.c to io.c

No functional change.

Revision 1.222: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:11:46 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +11 -11 lines
indent: replace direct access to the input buffer

This is a preparation for abstracting away all the low-level details of
handling the input.  The goal is to fix the current bugs regarding line
number counting, out of bounds memory access, and generally unreadable
code.

No functional change.

Revision 1.221: download - view: text, markup, annotated - select for diffs
Fri Nov 19 15:34:25 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +23 -16 lines
indent: add debug logging for input buffer handling

Revision 1.220: download - view: text, markup, annotated - select for diffs
Fri Nov 19 15:32:13 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +59 -58 lines
indent: rename input buffer variables

From reading the names 'save_com' and 'sc_end', it was not obvious
enough that these two variables are the limits of the same buffer, the
names were just too unrelated.

No functional change.

Revision 1.219: download - view: text, markup, annotated - select for diffs
Fri Nov 19 15:28:32 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +61 -68 lines
indent: group variables for input handling

No functional change.

Revision 1.218: download - view: text, markup, annotated - select for diffs
Sun Nov 7 19:18:56 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +10 -11 lines
indent: fix handling of C99 comments after 'if (expr)'

Revision 1.217: download - view: text, markup, annotated - select for diffs
Sun Nov 7 18:49:02 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +3 -2 lines
indent: demonstrate disappearing form feed

Revision 1.216: download - view: text, markup, annotated - select for diffs
Sun Nov 7 18:26:17 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +8 -8 lines
indent: various cleanups

Make several comments more precise.

Rename process_end_of_file to process_eof to match the token name.

Change the order of assignments in analyze_comment to keep the com_ind
computations closer together.

In copy_comment_wrap, use pointer difference instead of pointer addition
to stay away from undefined behavior.

No functional change.

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sun Nov 7 15:18:25 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +15 -15 lines
indent: rename ps.decl_nest to decl_level

This better matches the comment.

No functional change.

Revision 1.214: download - view: text, markup, annotated - select for diffs
Sun Nov 7 14:00:35 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +4 -4 lines
indent: reduce negations in process_else, clean up comments

No functional change.

Revision 1.213: download - view: text, markup, annotated - select for diffs
Sun Nov 7 13:30:15 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +5 -5 lines
indent: only access buffer data in the range [buf.s, buf.e)

No functional change.

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sun Nov 7 07:44:59 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +3 -3 lines
indent: rename type_at_paren_level_0 to type_outside_parentheses

For symmetry with type_in_parentheses.

No functional change.

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sun Nov 7 07:35:06 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +6 -5 lines
indent: distinguish between typename in parentheses and other words

This gets rid of two members of parser_state. No functional change for
well-formed programs. The sequence of '++int' or '--size_t' may be
formatted differently than before, but no program is expected to contain
that sequence.

Rename lsym_ident to lsym_word since 'ident' was too specific. This
token type is used for constants and string literals as well. Strictly
speaking, a string literal is not a word, but at least it's better than
before.

Revision 1.210: download - view: text, markup, annotated - select for diffs
Sun Nov 7 07:06:00 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +10 -10 lines
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.209: download - view: text, markup, annotated - select for diffs
Fri Nov 5 19:42:48 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +6 -6 lines
indent: rename process_keyword_do to process_do, same for 'else'

Before the symbols from the tokenizer had the prefix 'lsym', the symbols
could not be simply called 'else' and 'do'. The functions for processing
the tokens followed that naming scheme.

When the prefix 'lsym' was introduced, the word 'keyword' was no longer
needed, neither in the constants nor in the function names.

No functional change.

Revision 1.208: download - view: text, markup, annotated - select for diffs
Fri Nov 5 19:33:28 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +3 -3 lines
indent: rename ps.curr_newline to next_col_1

For symmetry with ps.curr_col_1.

No functional change.

Revision 1.207: download - view: text, markup, annotated - select for diffs
Thu Nov 4 20:31:04 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +31 -26 lines
indent: split process_comment_in_code into separate functions

No functional change.

Revision 1.206: download - view: text, markup, annotated - select for diffs
Thu Nov 4 17:12:12 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +13 -3 lines
indent: fix joining of adjacent unary '+' operators

Revision 1.205: download - view: text, markup, annotated - select for diffs
Wed Nov 3 21:47:35 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +4 -5 lines
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.204: download - view: text, markup, annotated - select for diffs
Mon Nov 1 23:44:08 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +3 -2 lines
indent: fix missing blank after 'return' (since 2021-10-31)

In indent.c 1.200 from 2021-10-31, the subtypes of identifier tokens
were removed since they were redundant. An unintended side effect was
that a parenthesized expression after 'return' was no longer separated
by a blank.

Before that change, 'return' was tokenized as an lsym_ident with subtype
kw_other, and want_space_before_lparen handled this case in the last
line. After the change, 'return' was treated as an ordinary identifier,
and unless the option '-pcs' (blank after function call) was given, the
blank was removed.

The other keywords that had kw_other are not affected since they do not
expect a '(' afterwards. These keywords are 'break', 'continue', 'goto',
'inline' and 'restrict'.

Curiously, there was not a single test case that covered 'return(expr)'.

While here, remove the trailing ',' from the enum lexer_symbol, which is
not allowed in standard C, it is a GNU extension. Lint doesn't complain
about this since the default LINTFLAGS include '-g' for GCC mode.

Revision 1.203: download - view: text, markup, annotated - select for diffs
Sun Oct 31 22:38:12 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +3 -3 lines
indent: clean up

Initialize buffers in reading order, make comments more expressive,
rename add_typename to register_typename, remove unused macro.

No functional change.

Revision 1.202: download - view: text, markup, annotated - select for diffs
Sun Oct 31 21:43:43 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +9 -9 lines
indent: for '-pcs', add blank between function and '('

Before indent-2021.09.30.21.48.12, the blank had always been added, even
in '-npcs' mode. Since then, the blank had never been added.

Now, add the blank in '-pcs' mode and omit it in '-npcs' mode.

Revision 1.201: download - view: text, markup, annotated - select for diffs
Sun Oct 31 20:40:42 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +3 -3 lines
indent: replace kw_tag with lsym_tag

This leaves only one special type of token, which is lsym_ident, which
in some cases represents a type name and in other cases an identifier,
constant or string literal.

No functional change.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Sun Oct 31 19:57:44 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +3 -3 lines
indent: replace simple cases of keyword_kind with lexer_symbol

The remaining keyword kinds 'tag' and 'type' require a bit more thought,
so do them in a separate step.

No functional change.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Sun Oct 31 19:20:52 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +3 -3 lines
indent: rename lsym_type to better reflect reality

Type names that occur in parentheses are parsed as lsym_ident having the
subtype kw_type instead.

No functional change.

Revision 1.198: download - view: text, markup, annotated - select for diffs
Sun Oct 31 10:09:43 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +6 -5 lines
indent: add separate lexer symbol for offsetof

No functional change.

Revision 1.197: download - view: text, markup, annotated - select for diffs
Sun Oct 31 10:00:37 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +6 -3 lines
indent: add separate lexer symbol for sizeof

The plan is to get rid of the type keyword_kind, which largely overlaps
with lexer_symbol.

No functional change.

Revision 1.196: download - view: text, markup, annotated - select for diffs
Sat Oct 30 23:27:33 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +13 -17 lines
indent: push down variable comment_buffered

No functional change.

Revision 1.195: download - view: text, markup, annotated - select for diffs
Sat Oct 30 22:36:07 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +4 -4 lines
indent: rename prev_newline and prev_col_1 to curr

These two flags describe the token that is currently processed.

In process_binary_op, curr_newline can never be true since newline is
not a binary operator, so remove that condition.

No functional change.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Sat Oct 30 20:01:46 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +8 -7 lines
indent: reorder assignments in switch_buffer

No functional change.

Revision 1.193: download - view: text, markup, annotated - select for diffs
Sat Oct 30 18:58:04 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +68 -68 lines
indent: move buffer functions further up

No functional change.

Revision 1.192: download - view: text, markup, annotated - select for diffs
Sat Oct 30 18:47:36 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +6 -5 lines
indent: group variables by topic

No functional change.

Revision 1.191: download - view: text, markup, annotated - select for diffs
Sat Oct 30 17:55:44 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +6 -4 lines
indent: prevent buffer overflow in search_stmt_comment

printf '{ if (%010000d) /*comment*/ ; }' '0' | indent

Revision 1.190: download - view: text, markup, annotated - select for diffs
Sat Oct 30 17:18:25 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +27 -2 lines
indent: add debug logging for save_com

This will help in finding the proper fix for the assertion failure in
search_stmt_comment.

Add an assertion in search_stmt_lbrace to prevent the previous,
incomplete fix from being applied again.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Sat Oct 30 16:18:51 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +48 -37 lines
indent: prevent buffer overflows in 'if (expr) ... stmt'

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sat Oct 30 15:26:58 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +13 -6 lines
indent: revert previous fix of assertion failure

The strange code with the out of bounds memory access is needed to
transform 'if (expr) /* comment */ {' to 'if (expr) { /* comment */',
that is, to move the comment to the right.

Add a test that prevents "repairing" this code again.

Revision 1.187: download - view: text, markup, annotated - select for diffs
Sat Oct 30 13:30:26 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +6 -13 lines
indent: fix assertion failure in search_stmt_comment

I have no idea why the code was written in such a convoluted way before.
By removing all the code that didn't make sense, everything just works
as expected, and the existing tests all pass, especially those in
token_comment.c that mention search_stmt_comment.

Revision 1.186: download - view: text, markup, annotated - select for diffs
Sat Oct 30 11:37:38 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +5 -3 lines
indent: replace tabsize with hardcoded 8 in process_comma

On 2018-07-25, FreeBSD added the option '-ts' to make the tabulator size
configurable, replacing several constants 7, 8, 9 with tabsize. The 8 in
the expression 'max_col - 8' was not related to the tabulator size but
instead represents the typical width of a variable name. Subtracting a
tab from the right margin doesn't make sense since the right margin need
not be aligned on a tabstop.

See the test fmt_decl.c, where the declaration 'struct s0 a,b;' is split
into several lines because the estimate for the variable name following
the comma is too high. There would have been plenty of space to the
right to keep the whole declaration in a single line.

No functional change.

Revision 1.185: download - view: text, markup, annotated - select for diffs
Sat Oct 30 11:10:36 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +3 -3 lines
indent: don't risk a buffer overflow in code_add_decl_indent

The buffers have a safety margin of 5 characters, so the bounds check is
not strictly necessary. It makes the code more uniform though.

No functional change.

Revision 1.184: download - view: text, markup, annotated - select for diffs
Sat Oct 30 11:05:26 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +9 -17 lines
indent: clean up code_add_decl_indent

In layout computations, it is helpful for human readers to list the
summands in logical order. In this case, the expression 'code_len +
base_ind' was rather confusing, so replace it with 'base_ind +
code_len'. This makes the code straight-forward enough that it doesn't
need any comments anymore.

No functional change.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Sat Oct 30 10:59:07 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +5 -5 lines
indent: remove confusing modulo from code_add_decl_indent

The only effects of the modulo operation was to make indent slower and
to confuse human readers.

During the computation of the indentation, the main focus is on the
difference between the current indentation, as computed from the base
indentation and the current code, and the target indentation. All these
computations take opt.tabsize into account. When looking only at the
difference, whether or not a multiple of opt.tabsize is added does not
matter.

No functional change.

Revision 1.182: download - view: text, markup, annotated - select for diffs
Sat Oct 30 10:01:31 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +3 -5 lines
indent: inline bloated call to 'parse' during initialization

No functional change.

Revision 1.181: download - view: text, markup, annotated - select for diffs
Sat Oct 30 09:51:22 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +9 -14 lines
indent: condense code for parsing command line arguments

Previously, the cascade of 'if' statements suggested that there were 6
different cases to be handled when in reality there are only 3: no
arguments, 1 argument, 2 arguments. Let the code express this directly.

No functional change.

Revision 1.180: download - view: text, markup, annotated - select for diffs
Sat Oct 30 09:42:31 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +26 -18 lines
indent: extract main_load_profiles from main_parse_command_line

No functional change.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Fri Oct 29 23:48:50 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +3 -2 lines
indent: remove redundant comments, remove punctuation from debug log

The comment about 'null stmt' between braces probably meant 'no
statements between braces'.

The comments at psym_switch_expr only repeated what the code says or had
been outdated 29 years ago already since opt.case_indent does not have
to be 'one level down'.

In the debug log, the quotes around the symbol names are not necessary
after a ':'. The parse stack also does not need this much punctuation.

Reducing a do-while loop to nothing instead of a statement saves a few
CPU cycles. It works because after each lbrace, a stmt is pushed to the
parser stack. This stmt can only ever be reduced to a stmt_list but
never be removed.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Fri Oct 29 21:56:36 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +3 -3 lines
indent: fix missing blank before binary operator

Revision 1.177: download - view: text, markup, annotated - select for diffs
Fri Oct 29 20:27:42 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +7 -7 lines
indent: merge isblank and is_hspace into ch_isblank

No functional change.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Fri Oct 29 20:05:58 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +4 -2 lines
indent: replace segmentation fault with assertion

Revision 1.175: download - view: text, markup, annotated - select for diffs
Fri Oct 29 19:31:24 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +7 -7 lines
indent: initialize 'ps' via code

This saves 3 kB of binary size since the parser state is rather large
and only very few members are initialized to non-zero values.

No functional change.

Revision 1.174: download - view: text, markup, annotated - select for diffs
Fri Oct 29 19:22:55 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +12 -27 lines
indent: clean up main_init_globals

No functional change.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Fri Oct 29 19:12:48 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +16 -13 lines
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.172: download - view: text, markup, annotated - select for diffs
Fri Oct 29 18:50:52 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +8 -2 lines
indent: mark obviously broken code

Revision 1.171: download - view: text, markup, annotated - select for diffs
Fri Oct 29 17:50:37 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +11 -11 lines
indent: use prev/curr/next to refer to the current token

The word 'last' just didn't match with 'next'.

No functional change.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Fri Oct 29 17:32:22 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +19 -20 lines
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.169: download - view: text, markup, annotated - select for diffs
Fri Oct 29 16:59:35 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +7 -8 lines
indent: keep p_l_follow nonnegative, use consistent comparison

No functional change.

Revision 1.168: download - view: text, markup, annotated - select for diffs
Fri Oct 29 16:54:51 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +9 -9 lines
indent: spell 'parentheses' properly in messages and comments

Revision 1.167: download - view: text, markup, annotated - select for diffs
Thu Oct 28 22:20:08 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +7 -8 lines
indent: clean up indentation, comments, reduce

No functional change.

Revision 1.166: download - view: text, markup, annotated - select for diffs
Thu Oct 28 22:06:23 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +5 -3 lines
indent: remove unused local variable in lexi

Since the previous commit, lexi is always called with the same argument,
so remove that parameter.

The previous commit broke the debug logging by not printing "transient
state" anymore. Replace this with "rolled back parser state" at the
caller's site.

No functional change.

Revision 1.165: download - view: text, markup, annotated - select for diffs
Thu Oct 28 21:56:26 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +8 -9 lines
indent: reduce negations in search_stmt_lookahead

No functional change.

Revision 1.164: download - view: text, markup, annotated - select for diffs
Thu Oct 28 21:51:43 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +15 -15 lines
indent: clean up comments and function names

Having accurate names for the lexer symbols and the parser symbols makes
most of the comments redundant. Remove these.

Rename process_decl to process_type, to match the name of the
corresponding lexer symbol. In this phase, it's just a single type
token, not a whole declaration.

No functional change.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Thu Oct 28 21:32:49 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +3 -3 lines
indent: make error messages for option parsing more precise

Revision 1.162: download - view: text, markup, annotated - select for diffs
Tue Oct 26 21:37:27 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +3 -3 lines
indent: clean up process_comment

There is no undefined behavior since the compared characters are always
from the basic execution character set. All other cases are covered by
the condition above for now_len.

Fix debug logging for non-ASCII characters, previously a character was
output as \xffffffc3.

Revision 1.161: download - view: text, markup, annotated - select for diffs
Tue Oct 26 20:43:35 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +6 -7 lines
indent: make ps.keyword easier to understand

Previously, ps.keyword did not have any documentation and was not
straight-forward. In some cases it was reset to kw_0, in others it was
set to an interesting value. The idea behind it was to remember the kind
of word of the previous token, to decide whether to have a space between
sizeof or offsetof and a following '('.

No functional change.

Revision 1.160: download - view: text, markup, annotated - select for diffs
Tue Oct 26 19:36:30 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +8 -8 lines
indent: run indent on its own source code

With manual corrections afterwards, to compensate for the remaining bugs
in indent.

Without the type definitions in .indent.pro, the opening braces of the
functions kw_name and lexi_alnum would not be at the beginning of the
line.

Revision 1.159: download - view: text, markup, annotated - select for diffs
Mon Oct 25 21:33:24 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +5 -3 lines
indent: improve debug logging

Output the various details in chronological order.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Mon Oct 25 19:56:03 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +20 -20 lines
indent: rename search_brace to search_stmt

No functional change.

Revision 1.157: download - view: text, markup, annotated - select for diffs
Mon Oct 25 01:06:13 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +37 -36 lines
indent: rename local variable sp_sw to spaced_expr

The 'sp' probably meant 'space-enclosed'; no idea what 'sw' was meant to
mean. Maybe 'switch', but that would have been rather ambiguous when
talking about control flow statements.

No functional change.

Revision 1.156: download - view: text, markup, annotated - select for diffs
Mon Oct 25 00:54:37 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +108 -112 lines
indent: split type token_type into 3 separate types

Previously, token_type was used for 3 different purposes:

1. symbol types from the lexer
2. symbol types on the parser stack
3. kind of control statement for 'if (expr)' and similar statements

Splitting the 41 constants into separate types makes it immediately
clear that the parser stack never handles comments, preprocessing lines,
newlines, form feeds, the inner structure of expressions.

Previously, the constant switch_expr was especially confusing since it
was used for 3 different purposes: when returned from lexi, it
represented the keyword 'switch', in the parser stack it represented
'switch (expr)', and it was used for a statement head as well.

The only overlap between the lexer symbols and the parser symbols are
'{' and '}', and the keywords 'do' and 'else'. To increase confusion,
the constants of the previous token_type were in apparently random
order and before 2021, they had cryptic, highly abbreviated names.

No functional change.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Sun Oct 24 22:44:13 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +7 -6 lines
indent: rename form_feed to tt_lex_form_feed

No functional change.

Revision 1.154: download - view: text, markup, annotated - select for diffs
Sun Oct 24 22:38:20 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +16 -9 lines
indent: split kw_for_or_if_or_while into separate constants

No functional change.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Sun Oct 24 22:28:06 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +11 -11 lines
indent: split kw_do_or_else into separate constants

It was unnecessarily confusing to have the token types keyword_do_else,
keyword_do and keyword_else at the same time, without any hint in what
they differed.

Some of the token types seem to be used by the lexer while others are
used in the parse stack. Maybe all token types can be partitioned into
these groups, which would suggest to use two different types for them.
And if not, it's still clearer to have this distinction in the names of
the constants.

No functional change.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sun Oct 24 20:57:11 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +15 -15 lines
indent: rename seen_quest to quest_level

The new name aligns with other similar variables like ind_level,
case_ind_level and ifdef_level. The old name 'seen' is mainly used for
bool variables.

No functional change.

Revision 1.151: download - view: text, markup, annotated - select for diffs
Sun Oct 24 20:43:27 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +6 -3 lines
indent: fix indentation of ad-hoc tagged variables

Seen among others in usr.bin/indent/lexi.c, variable 'keywords'.

Revision 1.150: download - view: text, markup, annotated - select for diffs
Sun Oct 24 19:33:26 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +11 -16 lines
indent: initialize variables in main_loop in declaration

No functional change.

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sun Oct 24 19:14:33 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +19 -21 lines
indent: run indent on its own source code

With manual corrections afterwards. Indent still does not get
extra_expr_indent correctly, it also indents global variables after
tagged declarations too deep.

No functional change.

Revision 1.148: download - view: text, markup, annotated - select for diffs
Sun Oct 24 17:19:48 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +18 -2 lines
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.147: download - view: text, markup, annotated - select for diffs
Sun Oct 24 16:51:44 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +4 -2 lines
indent: fix line number counting at beginning of function body

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sun Oct 24 11:19:25 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +6 -6 lines
indent: rename nitems to array_length

Revision 1.145: download - view: text, markup, annotated - select for diffs
Sun Oct 24 11:17:05 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +3 -4 lines
indent: replace global variable use_ff with function parameter

Revision 1.144: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:37:21 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +5 -6 lines
indent: rename ps.last_u_d to match its comment

No functional change.

Revision 1.143: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:26:46 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +6 -6 lines
indent: rename parser stack variables

No functional change.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:14:21 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +13 -13 lines
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.141: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:07:08 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +11 -7 lines
indent: invert condition in process_newline

It's hard to follow a condition that combines many negated terms with
'||'. Group the conditions by their origin.

The condition '!opt.break_after_comma && break_comma' still sounds like
a contradition, more investigations to follow.

No functional change.

Revision 1.140: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:00:37 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +4 -4 lines
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.139: download - view: text, markup, annotated - select for diffs
Tue Oct 19 18:29:59 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +3 -3 lines
indent: if a file ends with indent off, don't add space-newline

Revision 1.138: download - view: text, markup, annotated - select for diffs
Sun Oct 17 18:13:00 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +2 -6 lines
indent: parse int command line options strictly

On i386 and other platforms where LONG_MAX == INT_MAX, the test
t_errors/option_tabsize_very_large failed since the behavior on integer
overflow differs between ILP32 and LP64 platforms. Noticed by gson@.

Avoid this unintended difference by adding reasonable limits for each of
the integer options and by replacing atoi with strtol.

Revision 1.137: download - view: text, markup, annotated - select for diffs
Sat Oct 9 11:13:25 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +8 -16 lines
indent: condense code for calculating indentations

No functional change.

Revision 1.136: download - view: text, markup, annotated - select for diffs
Sat Oct 9 11:00:27 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +4 -4 lines
indent: extract common code for advancing a single tab

No functional change.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Fri Oct 8 23:47:40 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +17 -20 lines
indent: clean up comments, parentheses, debug messages, boolean operator

No functional change.

Revision 1.134: download - view: text, markup, annotated - select for diffs
Fri Oct 8 23:43:33 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +12 -15 lines
indent: rename in_or_st to init_or_struct

This makes a few comments redundant.

No functional change.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Fri Oct 8 21:13:58 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +4 -4 lines
indent: rename fill_buffer to inbuf_read_line

No functional change.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Fri Oct 8 20:45:22 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +7 -7 lines
indent: clean up process_decl, replace unnecessary strlen

No functional change.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Fri Oct 8 20:33:18 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +78 -81 lines
indent: remove unnecessary forward declarations

No functional change.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Fri Oct 8 20:28:56 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +5 -11 lines
indent: reduce negations in main_loop

No functional change.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Fri Oct 8 20:14:52 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +21 -18 lines
indent: fix parsing of preprocessor lines with comments and strings

Revision 1.128: download - view: text, markup, annotated - select for diffs
Fri Oct 8 19:03:34 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +4 -5 lines
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.127: download - view: text, markup, annotated - select for diffs
Fri Oct 8 16:47:42 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +30 -24 lines
indent: split process_keyword_do_else into separate functions

No functional change.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri Oct 8 16:20:33 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +7 -7 lines
indent: rename tokens lparen and rparen to be more precise

No functional change.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Thu Oct 7 23:18:47 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +11 -11 lines
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.124: download - view: text, markup, annotated - select for diffs
Thu Oct 7 23:15:15 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +31 -34 lines
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.123: download - view: text, markup, annotated - select for diffs
Thu Oct 7 23:01:32 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +5 -4 lines
indent: move definition of bufsize from header to implementation

No functional change.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Thu Oct 7 22:56:49 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +12 -10 lines
indent: rename opt.btype_2 to brace_same_line

No functional change.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Thu Oct 7 22:52:13 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +3 -3 lines
indent: clean up code, remove outdated wrong comments

No functional change.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:57:21 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +4 -7 lines
indent: use braces around multi-line statements

No functional change.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:52:54 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +47 -3 lines
indent: let the code breathe a bit by inserting empty lines

No functional change.

Revision 1.118: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:43:20 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +13 -15 lines
indent: clean up comments

No functional change.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:41:59 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +6 -8 lines
indent: fix wrong or outdated comments

No functional change.

Revision 1.116: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:38:25 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +17 -19 lines
indent: remove redundant comments

No functional change.

Revision 1.115: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:16:36 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +116 -115 lines
indent: reduce indentation

No functional change.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Thu Oct 7 19:42:41 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +3 -3 lines
indent: remove global variable option_source

It is only needed at startup, while parsing the options. The string "?"
was not needed at all.

No functional change.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Thu Oct 7 19:35:50 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +11 -14 lines
indent: clean up colon handling

No functional change.

Revision 1.112: download - view: text, markup, annotated - select for diffs
Thu Oct 7 19:17:07 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +68 -84 lines
indent: add high-level API for working with buffers

This makes the code more boring to read, which is actually good. Less
fiddling with memcpy and pointer arithmetics.

Since indent is not a high-performance tool used for bulk operations on
terabytes of source code, there is no need to squeeze out every possible
CPU cycle.

No functional change.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Thu Oct 7 18:48:31 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +12 -12 lines
indent: rename copy_id to copy_token

No functional change.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Thu Oct 7 18:32:09 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +17 -11 lines
indent: raise WARNS from the default 5 up to 6

Revision 1.109: download - view: text, markup, annotated - select for diffs
Thu Oct 7 18:19:07 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +6 -2 lines
indent: prevent division by zero

Revision 1.108: download - view: text, markup, annotated - select for diffs
Tue Oct 5 18:50:42 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +4 -4 lines
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.107: download - view: text, markup, annotated - select for diffs
Tue Oct 5 17:14:45 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +3 -3 lines
indent: fix off-by-one error for indented first line

Revision 1.106: download - view: text, markup, annotated - select for diffs
Tue Oct 5 17:12:20 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +7 -7 lines
indent: make off-by-one error in main_prepare_parsing more visible

No functional change.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Tue Oct 5 16:33:25 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +53 -54 lines
indent: make variable names more expressive

The abbreviation 'dec' looked too much like 'decimal' instead of the
intended 'declaration'.

No functional change.

Revision 1.104: download - view: text, markup, annotated - select for diffs
Tue Oct 5 07:05:51 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +72 -72 lines
indent: remove variable name prefix 'inout_'

This makes the variable names more readable. The prefix is not actually
needed to understand the code, it is rather distracting.

The compiler and lint will guard against any accidental mismatch between
pointer, integer and bool.

No functional change.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:55:24 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +17 -24 lines
indent: fix Clang-Tidy warnings, clean up bakcopy

The comment above and inside bakcopy had been outdated for at least the
last 28 years, the backup file is named "%s.BAK", not ".B%s".

Prevent buffer overflow for very long filenames (sprintf -> snprintf).

Revision 1.102: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:49:19 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +11 -11 lines
indent: fix spelling in comments

Revision 1.101: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:09:42 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +6 -6 lines
indent: merge duplicate code into is_hspace

No functional change.

Revision 1.100: download - view: text, markup, annotated - select for diffs
Tue Oct 5 05:56:49 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +12 -13 lines
indent: clean up code for appending to buffers

Use *e++ for appending and e[-1] for testing the previously appended
character, like in other places in the code.

No functional change.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Tue Oct 5 05:39:14 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +12 -24 lines
indent: merge duplicate code for reading from input buffer

No functional change.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Sun Oct 3 18:44:51 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +3 -3 lines
indent: rename functions

There was no good reason for using the different verbs 'scan' and 'set'
for two functions that essentially do the same.

No functional change.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Sun Oct 3 18:41:36 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +3 -3 lines
indent: fix content of profile_name

Previously, profile_name included the leading "-P", which was confusing.

Revision 1.96: download - view: text, markup, annotated - select for diffs
Thu Sep 30 21:48:12 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +4 -2 lines
indent: remove space between ')' and '(' in declarations

Revision 1.95: download - view: text, markup, annotated - select for diffs
Thu Sep 30 21:38:43 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +11 -7 lines
indent: untangle want_blank_before_lparen

No functional change.

Revision 1.94: download - view: text, markup, annotated - select for diffs
Thu Sep 30 21:33:55 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +13 -7 lines
indent: extract want_blank_before_lparen

No functional change.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Thu Sep 30 20:58:26 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +4 -5 lines
indent: add space between ',' and '[' in C99 initializations

Revision 1.92: download - view: text, markup, annotated - select for diffs
Mon Sep 27 20:09:55 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +19 -21 lines
indent: let indent format the comments after previous refactoring

Before this refactoring, I had skipped this section of the code from
formatting since the 'default:' branch was enclosed in a block of its
own, and that block would have been indented one more level to the
right. Extracting that code into a separate function got rid of the
extra braces.

No functional change.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Mon Sep 27 20:00:41 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +201 -163 lines
indent: split search_brace into smaller functions

No functional change.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Mon Sep 27 18:21:47 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +2 -3 lines
indent: use binary instead of linear search when adding types

No functional change.

Revision 1.89: download - view: text, markup, annotated - select for diffs
Mon Sep 27 16:56:35 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +5 -5 lines
indent: rename rwcode to keyword_kind, various cleanup

No idea what the 'rw' in 'rwcode' meant, it had been imported that way
28 years ago. Since rwcode specifies the kind of a keyword, the prefix
'kw_' makes sense.

No functional change.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Sun Sep 26 21:23:31 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +14 -22 lines
indent: unexport global variables

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

No functional change.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Sun Sep 26 19:57:23 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +5 -6 lines
indent: negate and rename option.leave_comma

The old name did not mirror the description in the manual page, and it
was the only option that is negated. Inverting it allows the options
table to be compressed.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Sun Sep 26 19:37:11 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +144 -146 lines
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.85: download - view: text, markup, annotated - select for diffs
Sun Sep 26 18:52:16 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +4 -2 lines
indent: fix missing space between comma and ellipsis

According to lint's C grammar, in standard C an ellipsis only occurs
after a comma. There are GCC extensions that allow an ellipsis as the
only function parameter, as well as in 'case a ... b', but these are
rare.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:57:04 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +4 -4 lines
indent: misc cleanup

No functional change.

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:54:32 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +5 -5 lines
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.82: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:24:35 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +11 -24 lines
indent: use strlen instead of own implementation

The two loops looks similar but differ in a crucial detail that makes up
for a '+ 1'.

No functional change.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:14:21 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +17 -20 lines
indent: merge duplicate code for token buffers

No functional change.

Revision 1.80: download - view: text, markup, annotated - select for diffs
Sat Sep 25 21:42:43 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +21 -26 lines
indent: clean up argument handling

No functional change.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Sat Sep 25 20:56:53 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +20 -19 lines
indent: un-abbreviate a few parser_state members, clean up comments

No functional change.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Sat Sep 25 20:23:42 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +2 -3 lines
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.77: download - view: text, markup, annotated - select for diffs
Sat Sep 25 19:49:13 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +2 -3 lines
indent: reduce code and data size for lexing of numbers

Instead of having a table of strings (121 pointers + 121 data
relocations), reduce that table to the actual character data and use a
secondary table for looking up the correct row in the main table.

No functional change.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Sat Sep 25 18:49:03 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +3 -3 lines
indent: rename option variable to be more expressive

No functional change.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:36:51 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +35 -39 lines
indent: convert remaining ibool to bool

No functional change intended.

Revision 1.74: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:29:13 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +3 -3 lines
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.73: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:11:23 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +70 -66 lines
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.72: download - view: text, markup, annotated - select for diffs
Sat Sep 25 14:26:05 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +17 -17 lines
indent: merge duplicate code for initializing buffers

No functional change.

Revision 1.71: download - view: text, markup, annotated - select for diffs
Sat Sep 25 14:16:06 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +24 -33 lines
indent: clean up initialization of options

The default values in 'struct pro' were redundant but all consistent,
even with the commented defaults in main_parse_command_line.

No functional change.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Sat Sep 25 13:38:32 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -6 lines
indent: remove ifdef for lint

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

Revision 1.69: download - view: text, markup, annotated - select for diffs
Sat Sep 25 10:41:03 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +4 -5 lines
indent: move statistical values into a separate struct

No functional change.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sat Sep 25 08:23:31 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +35 -23 lines
indent: add nonnull memory allocation functions

The only functional change is a single error message.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sat Sep 25 08:04:13 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +31 -35 lines
indent: group global variables for token buffer

No functional change.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Sat Sep 25 07:59:52 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +20 -20 lines
indent: inline macro 'token'

No functional change.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Sat Sep 25 07:55:24 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +78 -83 lines
indent: group global variables for code buffer

No functional change.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Sat Sep 25 07:46:41 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +38 -39 lines
indent: rename variables of type token_type

The previous variable name 'code' conflicts with the buffer of the same
name.

No functional change.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:47:29 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +50 -53 lines
indent: group global variables for label buffer into struct

No functional change.

Revision 1.62: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:14:06 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +16 -19 lines
indent: group global variables for the comment buffer

No functional change.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Wed Aug 25 22:26:30 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +11 -21 lines
indent: fix lint warnings about type conversions on ilp32

No functional change.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Fri Mar 26 22:02:00 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +5 -5 lines
indent: fix Clang build everywhere but on amd64

No idea why Clang didn't complain about this on amd64, only on all other
platforms.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sun Mar 14 00:22:16 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +20 -19 lines
indent: fix lint warnings

No functional change.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sat Mar 13 18:46:39 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +13 -6 lines
indent: add debug logging for switching the input buffer

No functional change outside debug mode.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:51:08 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +16 -14 lines
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.56: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:25:23 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +5 -5 lines
indent: rename pr_comment to process_comment, clean up documentation

No functional change.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:14:14 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +10 -6 lines
indent: fix handling of '/*' in string literal in preprocessing line

Previously, the '/*' in the string literal had been interpreted as the
beginning of a comment, which was wrong.  Because of that, the variable
declaration in the following line was still interpreted as part of the
comment.  The comment even continued until the end of the file.

Due to indent's forgiving nature, it neither complained nor even
mentioned that anything had gone wrong.  The decision of rather
producing wrong output than failing early is a dangerous one.

At least, there should have been an error message that at the end of the
file, the parser was still in a a comment, expecting the closing '*/'.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Sat Mar 13 12:52:24 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +748 -608 lines
indent: split 'main_loop' into several functions

No functional change.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sat Mar 13 11:47:22 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +76 -65 lines
indent: split 'main' into manageable parts

Since several years (maybe even decades) compilers know how to inline
static functions that are only used once.  Therefore there is no need to
have overly long functions anymore, especially not 'main', which is only
called a single time and thus does not add any noticeable performance
degradation.

No functional change.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Mar 13 11:27:01 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +8 -10 lines
indent: remove redundant parentheses

No functional change.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Sat Mar 13 11:19:43 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +8 -8 lines
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.50: download - view: text, markup, annotated - select for diffs
Sat Mar 13 10:32:25 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +7 -5 lines
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.49: download - view: text, markup, annotated - select for diffs
Sat Mar 13 10:06:47 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +3 -3 lines
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.48: download - view: text, markup, annotated - select for diffs
Sat Mar 13 09:21:57 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +45 -2 lines
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.47: download - view: text, markup, annotated - select for diffs
Sat Mar 13 00:26:56 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +3 -3 lines
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.46: download - view: text, markup, annotated - select for diffs
Fri Mar 12 23:16:00 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +3 -3 lines
indent: replace 'target' with 'indent' in function names

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

No functional change.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Fri Mar 12 23:10:18 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +18 -34 lines
indent: use consistent indentation for 'else'

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

No functional change.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Fri Mar 12 00:15:34 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
indent: manually fix indentation

No functional change.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Thu Mar 11 22:32:06 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +24 -22 lines
indent: reduce indentation of check_size functions

No functional change.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Thu Mar 11 22:28:30 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +9 -9 lines
indent: remove redundant cast after allocation functions

No functional change.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Tue Mar 9 19:46:28 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +186 -182 lines
indent: extract search_brace from main

No functional change.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Tue Mar 9 19:32:41 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +21 -14 lines
indent: extract capsicum code out of the main function

No functional change.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Tue Mar 9 19:23:08 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +11 -9 lines
indent: rename a few more token types

The previous names were either too short or ambiguous.

No functional change.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Tue Mar 9 19:14:39 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +12 -11 lines
indent: make token names more precise

The previous 'casestmt' was wrong since a case label is not a statement
at all.

The previous 'swstmt' was overly short, and wrong as well, since it
represents only the 'switch (expr)' part, which is not a complete switch
statement.  Same for 'ifstmt', 'whilestmt', 'forstmt'.

The previous word 'head' was not precise enough since it didn't specify
exactly where the head ends and the body starts.  Especially for
handling the dangling else, this distinction is important.

No functional change.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Tue Mar 9 18:28:10 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +7 -7 lines
indent: rename a few tokens to be more obvious

For casual readers it is not obvious whether the 'sp' meant 'special' or
'space' or something entirely different.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Tue Mar 9 16:48:28 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +10 -10 lines
indent: manually indent comments

It's strange that indent's own code is not formatted by indent itself,
which would be a good demonstration of its capabilities.

In its current state, I don't trust indent to get even the tokenization
correct, therefore the only safe way is to format the code manually.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Mon Mar 8 20:20:11 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +3 -3 lines
indent: inline macro for backslash

No functional change.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon Mar 8 20:15:42 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +45 -15 lines
indent: convert big macros to functions

Each of these buffers is only modified in a single file.  This makes it
unnecessary to declare the macros in the global header.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Mon Mar 8 19:06:48 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +3 -3 lines
indent: fix printing of uninitialized 'token' in debug output

Revision 1.32: download - view: text, markup, annotated - select for diffs
Sun Mar 7 20:52:11 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +4 -5 lines
indent: sprinkle a few const

No functional change.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Sun Mar 7 20:30:48 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +5 -7 lines
indent: use named constants for the different types of keywords

This reduces the magic numbers in the code.  Most of these had their
designated constant name written in a nearby comment anyway.

The one instance where arithmetic was performed on this new enum type
(in indent.c) was a bit tricky to understand.

The combination rw_continue_or_inline_or_restrict looks strange, the
'continue' should intuitively belong to the other control flow keywords
in rw_break_or_goto_or_return.

No functional change.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Sun Mar 7 10:56:18 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +10 -7 lines
indent: for the token types, use enum instead of #define

This makes it easier to step through the code in a debugger.

No functional change.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sun Mar 7 10:42:48 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +3 -4 lines
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.28: download - view: text, markup, annotated - select for diffs
Sat Mar 6 20:30:06 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +3 -3 lines
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.27: download - view: text, markup, annotated - select for diffs
Thu Apr 23 00:17:34 2020 UTC (4 years, 6 months ago) by joerg
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +56 -2 lines
Avoid common symbol declarations

Revision 1.23.14.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:05:42 2020 UTC (4 years, 6 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.23.14.1: preferred, colored; branchpoint 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23.14.1: +19 -19 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sat Oct 19 15:44:31 2019 UTC (5 years ago) by christos
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +19 -19 lines
use stdarg, annotate function as __printflike and fix broken formats.

Revision 1.23.14.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:10:20 2019 UTC (5 years, 5 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +1194 -1198 lines
Sync with HEAD

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Thu Apr 4 20:39:17 2019 UTC (5 years, 7 months ago) by kamil
Branches: FREEBSD, CSRG
CVS tags: r340138
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +569 -457 lines
FreeBSD indent r340138

Revision 1.25: download - view: text, markup, annotated - select for diffs
Thu Apr 4 15:22:13 2019 UTC (5 years, 7 months ago) by kamil
Branches: MAIN
CVS tags: phil-wifi-20190609, netbsd-9-base, netbsd-9-4-RELEASE, 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
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +1194 -1201 lines
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.24: download - view: text, markup, annotated - select for diffs
Sun Feb 3 03:19:29 2019 UTC (5 years, 9 months ago) by mrg
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +5 -2 lines
- 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.23: download - view: text, markup, annotated - select for diffs
Mon Sep 5 00:40:29 2016 UTC (8 years, 2 months ago) by sevan
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, 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-3-RELEASE, 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
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +2 -4 lines
Drop main() prototype.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Thu Feb 25 13:23:27 2016 UTC (8 years, 8 months ago) by ginsbach
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +17 -17 lines
Fix obvious contraction spelling mistakes by adding missing apostrophes.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Mon Feb 22 22:01:48 2016 UTC (8 years, 8 months ago) by ginsbach
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +3 -3 lines
Use warnx(3).

Revision 1.20: download - view: text, markup, annotated - select for diffs
Mon Feb 22 19:04:18 2016 UTC (8 years, 8 months ago) by ginsbach
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +4 -6 lines
Use errx(3).

Revision 1.18.24.1: download - view: text, markup, annotated - select for diffs
Sun Sep 21 18:58:56 2014 UTC (10 years, 1 month ago) by snj
Branches: 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
Diff to: previous 1.18: preferred, colored; next MAIN 1.19: preferred, colored
Changes since revision 1.18: +39 -4 lines
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.19: download - view: text, markup, annotated - select for diffs
Thu Sep 4 04:06:07 2014 UTC (10 years, 2 months ago) by mrg
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +39 -4 lines
port the -ut / -nut options from freebsd.  -ut (default) enables tabs
in output, the -nut uses spaces.

Revision 1.17.6.1: download - view: text, markup, annotated - select for diffs
Wed May 13 19:19:52 2009 UTC (15 years, 6 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.17: preferred, colored; next MAIN 1.18: preferred, colored
Changes since revision 1.17: +12 -12 lines
Sync with HEAD.

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

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Apr 12 11:09:49 2009 UTC (15 years, 7 months ago) by lukem
Branches: 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
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +12 -12 lines
Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare)

Revision 1.16.28.1: download - view: text, markup, annotated - select for diffs
Thu Sep 18 04:29:13 2008 UTC (16 years, 1 month ago) by wrstuden
Branches: wrstuden-revivesa
Diff to: previous 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16: +6 -6 lines
Sync with wrstuden-revivesa-base-2.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Mon Jul 21 14:19:23 2008 UTC (16 years, 3 months ago) by lukem
Branches: MAIN
CVS tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, 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, 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
Branch point for: jym-xensuspend
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +6 -6 lines
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sat Oct 30 17:45:34 2004 UTC (20 years ago) by dsl
Branches: MAIN
CVS tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, 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, 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: wrstuden-revivesa
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +5 -4 lines
Add (unsigned char) cast to ctype functions

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Aug 7 11:14:08 2003 UTC (21 years, 3 months ago) by agc
Branches: MAIN
CVS tags: 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
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +29 -2 lines
Move UCB-licensed code from 4-clause to 3-clause licence.

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

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu Jun 19 15:45:22 2003 UTC (21 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +5 -2 lines
PR/21645: Mishka: Localized comments don't work with indent.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun May 26 22:53:38 2002 UTC (22 years, 5 months ago) by wiz
Branches: MAIN
CVS tags: fvdl_fs64_base
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +5 -7 lines
Remove #ifndef'd __STDC__ code. ANSIfy.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Mon Aug 20 12:00:55 2001 UTC (23 years, 2 months ago) by wiz
Branches: 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
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +3 -3 lines
precede, not preceed.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Jun 16 21:47:42 2001 UTC (23 years, 4 months ago) by kleink
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -3 lines
Handle a labeled statement at the beginning of a function correctly;
from Nagae Hidetake <nagae@tk.airnet.ne.jp> in PR bin/12781.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Dec 19 17:00:08 1998 UTC (25 years, 10 months ago) by christos
Branches: MAIN
CVS tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, minoura-xpg4dl-base, minoura-xpg4dl, comdex-fall-1999-base, comdex-fall-1999
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +7 -7 lines
char -> unsigned char, braces for gcc-2.8.1

Revision 1.9: download - view: text, markup, annotated - select for diffs
Thu Oct 8 01:30:27 1998 UTC (26 years, 1 month ago) by wsanchez
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +4 -2 lines
Get rid of multiply defined common symbols

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sun Sep 6 20:17:30 1998 UTC (26 years, 2 months ago) by mellon
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +4 -5 lines
Support indenting standard input.   When indenting standard input, write output to standard output.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Tue Aug 25 20:59:37 1998 UTC (26 years, 2 months ago) by ross
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +6 -4 lines
Add { and } to shut up egcs. Reformat the more questionable code.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Oct 19 03:17:17 1997 UTC (27 years ago) by lukem
Branches: 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
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1118 -1055 lines
WARNSify, fix .Nm usage, deprecate register, use <err.h>, KNFify (with indent!;)

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sat Oct 18 16:04:33 1997 UTC (27 years ago) by mrg
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +12 -8 lines
merge lite-2.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Jan 9 20:20:11 1997 UTC (27 years, 10 months ago) by tls
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +3 -1 lines
RCS ID police

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue May 7 18:32:28 1996 UTC (28 years, 6 months ago) by jtc
Branches: MAIN
CVS tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-PATCH001, netbsd-1-2-BETA, netbsd-1-2
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +2 -4 lines
Include appropriate header files to bring prototypes into scope.
Removed explicit errno declarations.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Aug 1 18:14:33 1993 UTC (31 years, 3 months ago) by mycroft
Branches: MAIN
CVS tags: 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
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +2 -1 lines
Add RCS identifiers.

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Tue Jun 8 03:22:08 1993 UTC (31 years, 5 months ago) by mrg
Branches: FREEBSD, CSRG
CVS tags: lite-2
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +6 -6 lines
4.4BSD-Lite2

Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Apr 9 12:59:10 1993 UTC (31 years, 7 months ago) by cgd
Branches: 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).

Diff request

This form allows you to request diffs 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.

Log view options

CVSweb <webmaster@jp.NetBSD.org>