The NetBSD Project

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

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.36 / (download) - annotate - [select for diffs], Sun Apr 24 10:36:37 2022 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.35: +22 -1 lines
Diff to previous 1.35 (colored)

tests/indent: migrate token tests to other tests

In indent.h 1.49 from 2021-10-25, the enumeration token_type was split
into lexer_symbol and parser_symbol to more clearly express that these
tokens fall into completely different classes of usage patterns.

Revision 1.35 / (download) - annotate - [select for diffs], Sun Apr 24 09:04:12 2022 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.34: +144 -144 lines
Diff to previous 1.34 (colored)

tests/indent: change directive from '#' to '//'

Using a '//' instead of '#' turns the directives into well-formed C
code, resulting in fewer error markers in the editor.

Revision 1.34 / (download) - annotate - [select for diffs], Sun Apr 24 08:52:44 2022 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.33: +4 -1 lines
Diff to previous 1.33 (colored)

tests/indent: normalize amount of empty lines between test cases

Revision 1.33 / (download) - annotate - [select for diffs], Fri Apr 22 21:21:20 2022 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.32: +1 -2 lines
Diff to previous 1.32 (colored)

indent: remove FreeBSD IDs

Most of the IDs were empty anyway.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Nov 27 20:33:39 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.31: +8 -7 lines
Diff to previous 1.31 (colored)

indent: fix out of bounds memory access (since 2021-11-25)

Revision 1.31 / (download) - annotate - [select for diffs], Sat Nov 27 19:21:42 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.30: +54 -1 lines
Diff to previous 1.30 (colored)

tests/indent: demonstrate strange formatting (since 2021-11-25)

Revision 1.30 / (download) - annotate - [select for diffs], Thu Nov 25 20:02:06 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

tests/indent: fix misleading typedef name

Revision 1.29 / (download) - annotate - [select for diffs], Thu Nov 25 18:36:30 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.28: +21 -16 lines
Diff to previous 1.28 (colored)

indent: improve heuristic for spaces around '*' in declarations

Revision 1.28 / (download) - annotate - [select for diffs], Thu Nov 25 18:20:21 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.27: +35 -1 lines
Diff to previous 1.27 (colored)

tests/indent: demonstrate more example for broken '*' in declarations

Since indent-2021.11.25.16.41.33.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Nov 25 17:10:53 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.26: +20 -19 lines
Diff to previous 1.26 (colored)

indent: fix heuristic for declaration/definition to post-1990 reality

Revision 1.26 / (download) - annotate - [select for diffs], Thu Nov 25 16:41:33 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.25: +44 -49 lines
Diff to previous 1.25 (colored)

indent: fix spacing for unknown type names in declarations

Revision 1.25 / (download) - annotate - [select for diffs], Thu Nov 25 16:05:07 2021 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.24: +37 -1 lines
Diff to previous 1.24 (colored)

tests/indent: test '*' in function declarations

Revision 1.24 / (download) - annotate - [select for diffs], Thu Nov 25 08:03:08 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.23: +15 -35 lines
Diff to previous 1.23 (colored)

indent: fix formatting of a few declarations involving unknown types

Revision 1.23 / (download) - annotate - [select for diffs], Wed Nov 24 21:34:34 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.22: +207 -1 lines
Diff to previous 1.22 (colored)

tests/indent: demonstrate several real-life formatting bugs

Collected by indenting usr.bin/make with the default profile.

The heuristic for distinguishing between type names and other
identifiers is way too primitive, it seems to have stopped evolving
somewhere before function prototypes were standardized in C90, at least
it handles function prototypes poorly.

indent-2014.09.04.04.06.07 added seemingly random spaces to
declarations, which were fixed in indent-2019.04.04.15.27.35, which came
5 years later. The latter commit introduced many new bugs, but it also
fixed this one.

The wrongly indented struct member declaration for HashTable has been
there since at least indent-2000.10.11.14.46.04.

The wrongly indented initializer expression was added in
indent-2019.04.04.15.27.35 (see above).

Revision 1.22 / (download) - annotate - [select for diffs], Sun Nov 21 11:02:25 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.21: +41 -1 lines
Diff to previous 1.21 (colored)

tests/indent: demonstrate wrong formatting of type names in declarations

Revision 1.21 / (download) - annotate - [select for diffs], Sat Nov 20 11:13:18 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

tests/indent: normalize empty lines in tests

Revision 1.20 / (download) - annotate - [select for diffs], Sat Nov 20 09:59:53 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

indent: clean up lint annotation and tests

Revision 1.19 / (download) - annotate - [select for diffs], Fri Nov 19 22:24:29 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.18: +33 -4 lines
Diff to previous 1.18 (colored)

tests/indent: refine and extend tests

Revision 1.18 / (download) - annotate - [select for diffs], Fri Nov 19 19:37:13 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.17: +12 -28 lines
Diff to previous 1.17 (colored)

indent: fix formatting of function definitions (since 2019-04-04)

In the definition of a function with a pointer return type, the
formatting depended on the name of the function.  Function names
matching [A-Za-z+] were formatted correctly, those containing [$0-9_]
weren't.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Nov 19 18:55:10 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

tests/indent: update comment for the fix from the previous commit

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

indent: fix lost function name (since 2019-04-04)

When indent searched for an identifier followed by a '(', to see whether
the identifier is a function name, it didn't care that the input buffer
could be resized due to a long line, which had made the pointer 'tp'
invalid.  Fix this by stopping the search at the end of the line.  A
better approach would be to have an unlimited lookahead buffer for
situations like these.  The code that deals with character input has
already been extracted to io.c, so it's possible to implement that now.

While here, fix another access to undefined memory, after the loop.

There is still the issue of overwriting procname[0] with a blank, which
results in inconsistent formatting depending on the function name,
probably another case of accessing undefined memory, although the
results have been reproducible, but that may have been pure luck.

The formatted code looks clearly broken, but that's still better than
losing a token and destroying the whole file.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Nov 18 23:06:51 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.14: +37 -1 lines
Diff to previous 1.14 (colored)

tests/indent: demonstrate disappearing function name

Since 2019-04-04, as usual.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 18 22:27:01 2021 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.13: +31 -1 lines
Diff to previous 1.13 (colored)

tests/indent: demonstrate another bug imported from FreeBSD

Side note: the newly added test crashes at least the following versions
of indent with a segmentation fault on x86_64:

2000.10.11.14.46.04
2000.10.14.18.07.10
2000.10.17.02.16.44
2000.10.19.14.48.53
2000.10.19.16.31.26
2001.03.16.06.23.20
2001.03.23.20.12.41
2001.06.16.21.47.42
2001.07.20.13.43.50
2001.08.20.12.00.55
2001.12.01.19.27.33
2002.05.26.22.53.38
2003.02.25.10.35.44

Revision 1.13 / (download) - annotate - [select for diffs], Sun Nov 7 07:45:00 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.12: +10 -10 lines
Diff to previous 1.12 (colored)

indent: rename type_at_paren_level_0 to type_outside_parentheses

For symmetry with type_in_parentheses.

No functional change.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Oct 31 19:20:53 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

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.11 / (download) - annotate - [select for diffs], Sun Oct 31 19:13:41 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

indent: remove support for pre-1978 variable initialization

Revision 1.10 / (download) - annotate - [select for diffs], Sun Oct 31 19:08:39 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.9: +21 -1 lines
Diff to previous 1.9 (colored)

tests/indent: test support for ancient initialization without '='

Revision 1.9 / (download) - annotate - [select for diffs], Sun Oct 31 17:22:48 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

indent: in debug log, print token subtype in same line

The keyword 'void' is parsed as lsym_type in some cases and lsym_ident
in others. Its corresponding keyword is always kw_type though. Put the
subtype into the same line as the other token information.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Oct 31 10:56:19 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.7: +35 -1 lines
Diff to previous 1.7 (colored)

tests/indent: document that 'void' is not always parsed as a type

Revision 1.7 / (download) - annotate - [select for diffs], Sat Oct 30 11:41:49 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.6: +7 -2 lines
Diff to previous 1.6 (colored)

tests/indent: document why declaration lines are broken unnecessarily

Revision 1.6 / (download) - annotate - [select for diffs], Wed Oct 27 00:04:51 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.5: +10 -9 lines
Diff to previous 1.5 (colored)

indent: fix indentation of local variable declarations

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

Revision 1.5 / (download) - annotate - [select for diffs], Tue Oct 26 23:58:40 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.4: +16 -1 lines
Diff to previous 1.4 (colored)

tests/indent: demonstrate another example of wrong formatting

Revision 1.4 / (download) - annotate - [select for diffs], Tue Oct 26 23:37:40 2021 UTC (15 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.3: +22 -1 lines
Diff to previous 1.3 (colored)

tests/indent: demonstrate wrong indentation of local declarations

Reported by RVP via private mail. Importing FreeBSD indent in 2019 fixed
the trailing space in line 1, at the cost of lots of other bugs.

indent-2000.10.11.14.46.04
| int				<-- trailing space
| main(void)
| {
| 	char            (*f1) () = NULL;
| 	char           *(*f1) () = NULL;
| 	char           *(*f2) ();
| }
indent-2019.02.03.03.19.29

indent-2019.04.04.15.27.35
| int
| main(void)
| {
| 	char		(*f1) () = NULL;
| char *(*	f1) () = NULL;
| char *(*	f2) ();
| }
indent-2021.09.30.21.38.43

indent-2021.09.30.21.48.12
| int
| main(void)
| {
| 	char		(*f1)() = NULL;
| char *(*	f1)() = NULL;
| char *(*	f2)();
| }

Revision 1.3 / (download) - annotate - [select for diffs], Sat Oct 23 20:07:03 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

tests/indent: remove redundant test list_head

The test cases are already in fmt_decl.c, in old_style_definition and
LIST_HEAD.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Oct 23 20:01:14 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.1: +114 -20 lines
Diff to previous 1.1 (colored)

tests/indent: migrate f_decls to using t_options, add more tests

Revision 1.1 / (download) - annotate - [select for diffs], Fri Oct 22 19:27:53 2021 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN

tests/indent: migrate a few more tests to t_options

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




CVSweb <webmaster@jp.NetBSD.org>