Home | History | Annotate | Download | only in indent
History log of /src/tests/usr.bin/indent/t_errors.sh
RevisionDateAuthorComments
 1.39  03-Jan-2025  rillig indent: fix line breaks in else-if sequences

The flag ps.want_newline did not adequately model the conditions under
which a line break should be inserted, thus the redesign.

A welcome side effect is that in statements like 'if (cond);', the
semicolon is now placed on a separate line, thus becoming more visible.
 1.38  10-Dec-2023  rillig branches: 1.38.2;
tests/indent: fix name of test case
 1.37  14-Jun-2023  rillig indent: allow more than 128 brace levels
 1.36  14-Jun-2023  rillig indent: allow more than 5 levels of #if/#endif
 1.35  10-Jun-2023  rillig indent: fix stack overflow, add more tests

For several parser symbols, 2 symbols are pushed in a row, which led to
an out-of-bounds write.
 1.34  09-Jun-2023  rillig indent: support C99 compound literals
 1.33  05-Jun-2023  rillig indent: fix trailing whitespace after comment
 1.32  04-Jun-2023  rillig tests/indent: cover code in lexi.c
 1.31  04-Jun-2023  rillig indent: fix formatting of compound expressions, at least partially
 1.30  21-May-2023  rillig tests/indent: fix outdated or wrong comments
 1.29  21-May-2023  rillig indent: don't error out on unrecognized preprocessor directives

This allows indent to be used on the GCC preprocessor output.
 1.28  14-May-2023  rillig indent: miscellaneous cleanups
 1.27  13-May-2023  rillig indent: do not add a space before a comment that starts a line
 1.26  13-May-2023  rillig indent: preserve indentation of preprocessor directives
 1.25  11-May-2023  rillig 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.
 1.24  22-Apr-2022  rillig indent: remove FreeBSD IDs

Most of the IDs were empty anyway.
 1.23  13-Feb-2022  rillig tests/indent: demonstrate the poor handling of compound literals
 1.22  25-Nov-2021  rillig indent: make error message for missing command line arguments clearer
 1.21  25-Nov-2021  rillig tests/indent: use escape sequence for newline characters

No functional change.
 1.20  07-Nov-2021  rillig indent: parse special options strictly
 1.19  07-Nov-2021  rillig tests/indent: test lenient option parsing
 1.18  07-Nov-2021  rillig indent: remove redundant assignment

At that point, ps.next_col_1 is already false.

No functional change.
 1.17  30-Oct-2021  rillig indent: fix assertion in fits_in_one_line
 1.16  30-Oct-2021  rillig tests/indent: demonstrate assertion failure in fits_in_one_line
 1.15  30-Oct-2021  rillig 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.
 1.14  30-Oct-2021  rillig 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.
 1.13  29-Oct-2021  rillig indent: replace segmentation fault with assertion
 1.12  29-Oct-2021  rillig tests/indent: demonstrate segmentation fault in search_stmt_comment
 1.11  29-Oct-2021  rillig indent: spell 'parentheses' properly in messages and comments
 1.10  29-Oct-2021  rillig tests/indent: provoke the third occurrence of 'unbalanced parens'
 1.9  29-Oct-2021  rillig tests/indent: provoke error messages for unbalanced parentheses
 1.8  28-Oct-2021  rillig indent: fix error message for buffer overflow during option parsing

At this early time, the input file has not been opened yet, so there is
no reason to output either the input file name or the line number.
 1.7  28-Oct-2021  rillig indent: make error messages for option parsing more precise
 1.6  28-Oct-2021  rillig indent: parse option '-cli' strictly
 1.5  24-Oct-2021  rillig 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.
 1.4  17-Oct-2021  rillig 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.
 1.3  14-Oct-2021  rillig tests/indent: cover more error cases and inline indentation
 1.2  14-Oct-2021  rillig tests/indent: provide full line coverage for argument handling
 1.1  13-Oct-2021  rillig indent: check command line options stricter

Previously, bool options were allowed to have trailing garbage. For
example, the option '-bacc' could be spelled '-bacchus' as well.

Check that the exact option name is given in the command line, to
prevent typos in the configuration files and to reduce surprises just in
case a future option is a prefix of an existing option, or vice versa.

Add a new test program for error handling. Most of these tests are so
simple that it would be overkill to create 3 files for each test.
 1.38.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed