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 function decla...
details: https://anonhg.NetBSD.org/src/rev/f86d61866e45
branches: trunk
changeset: 376289:f86d61866e45
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 09 09:49:07 2023 +0000
description:
indent: improve heuristics for function declaration vs. definition
diffstat:
tests/usr.bin/indent/fmt_decl.c | 9 ++++-----
usr.bin/indent/lexi.c | 7 +++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diffs (51 lines):
diff -r 38a486726faf -r f86d61866e45 tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c Fri Jun 09 09:45:55 2023 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c Fri Jun 09 09:49:07 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fmt_decl.c,v 1.51 2023/06/09 09:45:55 rillig Exp $ */
+/* $NetBSD: fmt_decl.c,v 1.52 2023/06/09 09:49:07 rillig Exp $ */
/*
* Tests for declarations of global variables, external functions, and local
@@ -1026,10 +1026,9 @@ typedef struct {
//indent end
//indent run -fbs -di0 -psl
-// $ FIXME: Must be detected as a function declaration, not a definition.
-static FILE *
-ArchFindMember(const char *, const char *,
- struct ar_hdr *, const char *);
+// $ Must be detected as a function declaration, not a definition.
+static FILE *ArchFindMember(const char *, const char *,
+ struct ar_hdr *, const char *);
bool
Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
diff -r 38a486726faf -r f86d61866e45 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c Fri Jun 09 09:45:55 2023 +0000
+++ b/usr.bin/indent/lexi.c Fri Jun 09 09:49:07 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lexi.c,v 1.218 2023/06/09 07:20:30 rillig Exp $ */
+/* $NetBSD: lexi.c,v 1.219 2023/06/09 09:49:07 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.218 2023/06/09 07:20:30 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.219 2023/06/09 09:49:07 rillig Exp $");
#include <stdlib.h>
#include <string.h>
@@ -338,6 +338,9 @@ probably_looking_at_definition(void)
else
break; /* func(...) { ... */
}
+
+ if (paren_level == 1 && p[0] == '*' && p[1] == ',')
+ return false;
}
/* To further reduce the cases where indent wrongly treats an
Home |
Main Index |
Thread Index |
Old Index