Module Name: src Committed By: rillig Date: Thu Nov 25 18:20:21 UTC 2021
Modified Files: src/tests/usr.bin/indent: fmt_decl.c Log Message: tests/indent: demonstrate more example for broken '*' in declarations Since indent-2021.11.25.16.41.33. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/indent/fmt_decl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/indent/fmt_decl.c diff -u src/tests/usr.bin/indent/fmt_decl.c:1.27 src/tests/usr.bin/indent/fmt_decl.c:1.28 --- src/tests/usr.bin/indent/fmt_decl.c:1.27 Thu Nov 25 17:10:53 2021 +++ src/tests/usr.bin/indent/fmt_decl.c Thu Nov 25 18:20:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fmt_decl.c,v 1.27 2021/11/25 17:10:53 rillig Exp $ */ +/* $NetBSD: fmt_decl.c,v 1.28 2021/11/25 18:20:21 rillig Exp $ */ /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */ /* @@ -789,3 +789,37 @@ function(void) #indent end #indent run-equals-input -di0 + + +/* + * In declarations, most occurrences of '*' are pointer type derivations. + * There are a few exceptions though. + * + * Broken since lexi.c 1.156 from 2021-11-25. + */ +#indent input +char str[expr * expr]; +char str[expr**ptr]; +char str[*ptr**ptr]; +char str[sizeof(expr * expr)]; +char str[sizeof(int) * expr]; +char str[sizeof(*ptr)]; +char str[sizeof(type**)]; +char str[sizeof(**ptr)]; +#indent end + +#indent run -di0 +/* $ FIXME: The '*' must be a binary operator. */ +char str[expr *expr]; +/* $ FIXME: The first '*' must be a binary operator. */ +char str[expr **ptr]; +/* $ FIXME: The second '*' must be a binary operator. */ +char str[*ptr **ptr]; +/* $ FIXME: The '*' must be a binary operator. */ +char str[sizeof(expr *expr)]; +/* $ FIXME: The '*' must be a binary operator. */ +char str[sizeof(int) *expr]; +char str[sizeof(*ptr)]; +char str[sizeof(type **)]; +char str[sizeof(**ptr)]; +#indent end