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: remove code for parsing declarations ...



details:   https://anonhg.NetBSD.org/src/rev/4a43bb7f7da5
branches:  trunk
changeset: 374785:4a43bb7f7da5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri May 12 15:36:02 2023 +0000

description:
indent: remove code for parsing declarations without semicolon

The statement from the comment that declarations do not need semicolons
is wrong. A possible input that matched this rule is 'void f(void) { int
a }'.

diffstat:

 usr.bin/indent/indent.c |  9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diffs (30 lines):

diff -r c3ff7cc95df5 -r 4a43bb7f7da5 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Fri May 12 13:29:41 2023 +0000
+++ b/usr.bin/indent/indent.c   Fri May 12 15:36:02 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.254 2023/05/12 10:53:33 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.255 2023/05/12 15:36:02 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c  5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.254 2023/05/12 10:53:33 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.255 2023/05/12 15:36:02 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -732,11 +732,6 @@ process_lbrace(void)
 static void
 process_rbrace(void)
 {
-    if (ps.s_sym[ps.tos] == psym_decl && !ps.block_init) {
-       /* semicolons can be omitted in declarations */
-       parse(psym_semicolon);
-    }
-
     if (ps.nparen > 0) {       /* check for unclosed if, for, else. */
        diag(1, "Unbalanced parentheses");
        ps.nparen = 0;



Home | Main Index | Thread Index | Old Index