From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 80801740038 for ; Mon, 3 Feb 2025 18:46:07 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=c7v66vEEmHBFDab+bFlaKB77rvgMpIQnnlAhUs8/h6c=; c=relaxed/simple; d=groups.io; h=Feedback-ID:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240830; t=1738608367; v=1; x=1738867565; b=h9pz4ZgHnMze0SkV594P3POQdJ/m7NoIBlY9aqdHCUwFcMv3DXk2rl6rPfk8TboTdmOp9TG4 yDjZyyVAP605MohmNhplygPuwGwf54B4qPKOsw0OMOB3SIsBaBgjs/B8ffUWELdvCqR6Yy3dp0g LI81lYIKShyvPBkKzprCJhre4e3pDebzQ/ec9dHW0c0DMemIKJtoBV/SUbgY2EUXrPCWqxJNHgg 6rEBimOqzfPBSUwfux1YCmODf0IVXzxK+zqIti/dPcKXr9OAlsoYKnStdOJsYeWi0POI5pZDaCp 6XC1tsu8zLaohKgR4pH9J/oHhF6nFPkKW4kzdZ/NCaCwA== X-Received: by 127.0.0.2 with SMTP id 6FTAYY7687511xno9p0TY4zR; Mon, 03 Feb 2025 10:46:05 -0800 X-Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) by mx.groups.io with SMTP id smtpd.web11.95892.1738608365220064050 for ; Mon, 03 Feb 2025 10:46:05 -0800 X-Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2B20F25401BC; Mon, 3 Feb 2025 13:46:04 -0500 (EST) X-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Mon, 03 Feb 2025 13:46:04 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukeefiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpeftvggsvggttggrucevrhgrnhcuoehrvggsvggttggrsegsshguihhord gtohhmqeenucggtffrrghtthgvrhhnpeegffefteeuvefghefggeetieegjeffhfelueeh ieevveehtdeggfethfeutddvudenucffohhmrghinhepthhirghnohgtohhrvgdrohhrgh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrvggs vggttggrsegsshguihhordgtohhmpdhnsggprhgtphhtthhopeeipdhmohguvgepshhmth hpohhuthdprhgtphhtthhopeguvghvvghlsegvughkvddrghhrohhuphhsrdhiohdprhgt phhtthhopehmihgthhgrvghlrdgurdhkihhnnhgvhiesihhnthgvlhdrtghomhdprhgtph htthhopehsphgsrhhoghgrnhesohhuthhlohhokhdrtghomhdprhgtphhtthhopehoshgu vgeslhhinhhugidrmhhitghrohhsohhfthdrtghomhdprhgtphhtthhopehpvggurhhord hfrghltggrthhosehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhgvsggvtggtrgessghs ughiohdrtghomh X-ME-Proxy: Feedback-ID: i5b994698:Fastmail X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Feb 2025 13:46:03 -0500 (EST) From: "Rebecca Cran" To: devel@edk2.groups.io, Michael Kinney , Sean Brogan , Oliver Smith-Denny , Pedro Falcato Cc: Rebecca Cran Subject: [edk2-devel] [PATCH edk2-CCodingStandardsSpecification v3 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC` Date: Mon, 3 Feb 2025 11:45:48 -0700 Message-ID: <20250203184548.2528198-2-rebecca@bsdio.com> In-Reply-To: <20250203184548.2528198-1-rebecca@bsdio.com> References: <20250203184548.2528198-1-rebecca@bsdio.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 03 Feb 2025 10:46:05 -0800 Resent-From: rebecca@bsdio.com Reply-To: devel@edk2.groups.io,rebecca@bsdio.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HRWZNFEyaIA22gGMCxNrbVoKx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=h9pz4ZgH; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io A while ago a decision was made on the edk2-devel mailing list that the `STATIC` EDK2 type should be replaced with the C keyword `static`. Following further discussion, it was decided to disallow static local variables to prevent breakage when using GoogleTest. Update the Coding Specification to match. While here, remove the outdated section disallowing static functions since they're no longer a problem. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Rebecca Cran --- 5_source_files/54_code_file_structure.md | 9 ++------- 5_source_files/56_declarations_and_types.md | 2 +- README.md | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/5_source_files/54_code_file_structure.md b/5_source_files/54_code_file_structure.md index 0c4d6a26820c..c286b273fe42 100644 --- a/5_source_files/54_code_file_structure.md +++ b/5_source_files/54_code_file_structure.md @@ -269,7 +269,8 @@ other than at the top level of a file as specified by this document. #### 5.4.2.2 Static -An object declared `STATIC` has either file or block scope. +An object declared `static` has file scope. +Objects may not be declared 'static' within functions. ##### 5.4.2.2.1 Do not reuse an object or function identifier with static storage duration. @@ -277,9 +278,3 @@ Throughout the set of source files defined within a single .inf file, do not reuse an identifier with static storage duration. The compiler may not be confused by this, but the user may confuse unrelated variables with the same name. - -##### 5.4.2.2.2 Functions should not be declared STATIC. - -Some source-level debuggers are unable to resolve static functions. Until it -can be verified that no one is dependent upon a debugger with this limitation, -it is strongly recommended that functions not be declared static. diff --git a/5_source_files/56_declarations_and_types.md b/5_source_files/56_declarations_and_types.md index ec1803d980e1..77e3ce99c457 100644 --- a/5_source_files/56_declarations_and_types.md +++ b/5_source_files/56_declarations_and_types.md @@ -38,7 +38,7 @@ Any abstract type that is defined must be constructed from other abstract types or from common EFI data types. -#### 5.6.1.2 The use of int, unsigned, char, void, static, long is a violation of the coding convention. +#### 5.6.1.2 The use of int, unsigned, char, void, long is a violation of the coding convention. The corresponding EFI types must be used instead. diff --git a/README.md b/README.md index 77cfdc8906b1..a8da462c3c46 100644 --- a/README.md +++ b/README.md @@ -114,4 +114,5 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. | | [#425](https://bugzilla.tianocore.org/show_bug.cgi?id=425) [CCS] clarify line breaking and indentation requirements for multi-line function calls | | | | [#1656](https://bugzilla.tianocore.org/show_bug.cgi?id=1656) Update all Wiki pages for the BSD+Patent license change with SPDX identifiers | | | | [#607](https://bugzilla.tianocore.org/show_bug.cgi?id=607) Document code comment requirements for spurious variable assignments | | -| 2.3 | Add 4.2 Directory names section and update File names section for the guidelines of module directory and file naming|September 2022|| +| 2.3 | Add 4.2 Directory names section and update File names section for the guidelines of module directory and file naming |September 2022| +| 2.4 | The use of the 'static' C keyword is now preferred over the EDK2 type 'STATIC' |February 2025| -- 2.48.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121076): https://edk2.groups.io/g/devel/message/121076 Mute This Topic: https://groups.io/mt/110977230/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-