Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: improve heuristics for '*' as a point...



details:   https://anonhg.NetBSD.org/src/rev/50b898ef947b
branches:  trunk
changeset: 376634:50b898ef947b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 26 20:10:23 2023 +0000

description:
indent: improve heuristics for '*' as a pointer type

diffstat:

 tests/usr.bin/indent/lsym_for.c |  5 ++---
 usr.bin/indent/lexi.c           |  7 ++++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r dbc1e20af584 -r 50b898ef947b tests/usr.bin/indent/lsym_for.c
--- a/tests/usr.bin/indent/lsym_for.c   Mon Jun 26 20:03:09 2023 +0000
+++ b/tests/usr.bin/indent/lsym_for.c   Mon Jun 26 20:10:23 2023 +0000
@@ -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) {
diff -r dbc1e20af584 -r 50b898ef947b usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Mon Jun 26 20:03:09 2023 +0000
+++ b/usr.bin/indent/lexi.c     Mon Jun 26 20:10:23 2023 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index