Module Name: src Committed By: rillig Date: Sat May 20 12:05:01 UTC 2023
Modified Files: src/tests/usr.bin/indent: opt_bap.c src/usr.bin/indent: io.c Log Message: indent: don't insert blank line between two closing lines To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_bap.c cvs rdiff -u -r1.183 -r1.184 src/usr.bin/indent/io.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/opt_bap.c diff -u src/tests/usr.bin/indent/opt_bap.c:1.7 src/tests/usr.bin/indent/opt_bap.c:1.8 --- src/tests/usr.bin/indent/opt_bap.c:1.7 Sat May 20 10:46:22 2023 +++ src/tests/usr.bin/indent/opt_bap.c Sat May 20 12:05:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_bap.c,v 1.7 2023/05/20 10:46:22 rillig Exp $ */ +/* $NetBSD: opt_bap.c,v 1.8 2023/05/20 12:05:01 rillig Exp $ */ /* * Tests for the options '-bap' and '-nbap' ("blank line after procedure @@ -95,3 +95,19 @@ has_several_blank_lines_below(void) int the_end; //indent end + + +/* + * Don't insert a blank line between the end of a function body and an '#endif' + * line, as both are closing elements. + */ +//indent input +#if 0 +void +example(void) +{ +} +#endif +//indent end + +//indent run-equals-input -bap Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.183 src/usr.bin/indent/io.c:1.184 --- src/usr.bin/indent/io.c:1.183 Sat May 20 11:53:53 2023 +++ src/usr.bin/indent/io.c Sat May 20 12:05:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.183 2023/05/20 11:53:53 rillig Exp $ */ +/* $NetBSD: io.c,v 1.184 2023/05/20 12:05:01 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: io.c,v 1.183 2023/05/20 11:53:53 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.184 2023/05/20 12:05:01 rillig Exp $"); #include <stdio.h> @@ -152,7 +152,8 @@ want_blank_line(void) && out.line_kind != lk_endif) return true; } - if (opt.blanklines_after_procs && out.prev_line_kind == lk_func_end) + if (opt.blanklines_after_procs && out.prev_line_kind == lk_func_end + && out.line_kind != lk_endif) return true; if (opt.blanklines_before_block_comments && out.line_kind == lk_block_comment)