git: ea86fed51909 - main - Style(9): Strengthen statements about not using K&R function definitions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Jul 2022 14:04:27 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea86fed51909de51b4a5e31a593d625e07f4b21d commit ea86fed51909de51b4a5e31a593d625e07f4b21d Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-07-28 13:58:32 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2022-07-28 14:01:54 +0000 Style(9): Strengthen statements about not using K&R function definitions K&R function definitions will soon be obsolete. Work has been underway to remove all K&R function definitions from the tree for a while now. A future C version will remove this construct from the language. So strengthen existing statements about K&R function definitions and declarations. While here, remove __P macro reference. It's not been in active use for almost two decades apart from legacy contrib code. Sponsored by: Netflix Reviewed by: pauamma, rpokala, hselasky, kp, brooks, markm, emaste Differential Revision: https://reviews.freebsd.org/D35945 --- share/man/man9/style.9 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index 2c080158567d..3b2e9d7e9d6f 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 1995-2019 The FreeBSD Project +.\" Copyright (c) 1995-2022 The FreeBSD Project .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -25,7 +25,7 @@ .\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd February 2, 2022 +.Dd July 28, 2022 .Dt STYLE 9 .Os .Sh NAME @@ -467,10 +467,6 @@ Functions that are used locally in more than one module go into a separate header file, e.g., .Qq Pa extern.h . .Pp -Do not use the -.Dv __P -macro. -.Pp In general code can be considered .Dq "new code" when it makes up about 50% or more of the file(s) involved. @@ -797,7 +793,10 @@ do not roll your own. } .Ed .Pp -When converting K&R style declarations to ANSI style, preserve +Do not use K&R style declarations or definitions, they are obsolete +and are forbidden in C23. +Compilers warn of their use and some treat them as an error by default. +When converting K&R style definitions to ANSI style, preserve any comments about parameters. .Pp Long parameter lists are wrapped with a normal four space indent.