git: ebfb117e2e04 - main - style(9): deprecate blank lines without local vars
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Dec 2024 21:44:01 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=ebfb117e2e04ea71b88e4285cbb1b54d9cc5248c commit ebfb117e2e04ea71b88e4285cbb1b54d9cc5248c Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2024-12-04 21:43:02 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2024-12-04 21:43:31 +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 --- share/man/man9/style.9 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index 9bf30370a374..04ee6fcdc0dd 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 2, 2024 +.Dd December 3, 2024 .Dt STYLE 9 .Os .Sh NAME @@ -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 statment. 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 ,