git: 9bc9cf4a2ae7 - stable/14 - style(9): deprecate blank lines without local vars
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 14 Dec 2024 00:11:56 UTC
The branch stable/14 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=9bc9cf4a2ae7209ccb19874234304301ed510e77 commit 9bc9cf4a2ae7209ccb19874234304301ed510e77 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2024-12-04 21:43:02 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2024-12-13 21:37:40 +0000 style(9): deprecate blank lines without local vars Previously (208be1617cda) such lines were made optional and several of us had the impression that they were more completely deprecated. Do that now. Requiring a blank line at the top of a function if there are no local declerations dates to the original style.9 commit (b030a30523649) and was present in the first version of admin/style/style from mckusick@ in 1991. It's certainly consistant to have a blank line after a null-set of variables, but today it's unique to BSD source code and an occational point of friction to new developers. Document the historic practice and encourage removal in the context of other changes, but not sweeping removal commits for their own sake. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D47887 (cherry picked from commit ebfb117e2e04ea71b88e4285cbb1b54d9cc5248c) (cherry picked from commit 028dae5d3e886fe4c171689d9fc733e1bd68be71) --- share/man/man9/style.9 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index ca96f05f8d55..59f0ff8b5c88 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -818,19 +818,15 @@ vaf(const char *fmt, ...) static void usage(void) { - /* Optional blank line goes here. */ .Ed .Pp -Optionally, insert a blank line at the beginning of functions with no local -variables. +Functions should have local variable declarations first, followed by one +blank line, followed by the first statement. +If no local variables are declared, the first line should be a statement. Older versions of this .Nm -document required the blank line convention, so it is widely used in existing -code. -.Pp -Do not insert a blank line at the beginning of functions with local variables. -Instead, these should have local variable declarations first, followed by one -blank line, followed by the first statement. +document required a blank line before code. +Such lines should be removed when signficant changes are made to the code. .Pp Use .Xr printf 3 ,