Module Name:    src
Committed By:   rillig
Date:           Mon Jun 26 20:10:23 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_for.c
        src/usr.bin/indent: lexi.c

Log Message:
indent: improve heuristics for '*' as a pointer type


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/lsym_for.c
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/indent/lexi.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/lsym_for.c
diff -u src/tests/usr.bin/indent/lsym_for.c:1.7 src/tests/usr.bin/indent/lsym_for.c:1.8
--- src/tests/usr.bin/indent/lsym_for.c:1.7	Thu Jun  8 21:18:54 2023
+++ src/tests/usr.bin/indent/lsym_for.c	Mon Jun 26 20:10:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_for.c,v 1.7 2023/06/08 21:18:54 rillig Exp $ */
+/* $NetBSD: lsym_for.c,v 1.8 2023/06/26 20:10:23 rillig Exp $ */
 
 /*
  * Tests for the token lsym_for, which represents the keyword 'for' that
@@ -105,8 +105,7 @@ function(void)
 
 //indent run
 {
-// $ FIXME: There should be no space after the '*'.
-	for (const list_item * i = first; i != NULL; i = i->next) {
+	for (const list_item *i = first; i != NULL; i = i->next) {
 	}
 // $ FIXME: There should be no space after the '*'.
 	for (list_item * *i = first; i != NULL; i = i->next) {

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.237 src/usr.bin/indent/lexi.c:1.238
--- src/usr.bin/indent/lexi.c:1.237	Mon Jun 26 10:23:59 2023
+++ src/usr.bin/indent/lexi.c	Mon Jun 26 20:10:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.237 2023/06/26 10:23:59 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.238 2023/06/26 20:10:23 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.237 2023/06/26 10:23:59 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.238 2023/06/26 20:10:23 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -401,7 +401,8 @@ lexi_alnum(void)
 		inp_p++;
 
 	ps.next_unary = ps.prev_lsym == lsym_tag
-	    || ps.prev_lsym == lsym_typedef;
+	    || ps.prev_lsym == lsym_typedef
+	    || (ps.prev_lsym == lsym_modifier && *inp_p == '*');
 
 	if (ps.prev_lsym == lsym_tag && ps.paren.len == 0)
 		return lsym_type;

Reply via email to