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 2DAE7AC1252 for ; Mon, 3 Feb 2025 11:26:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dgqztAYnNkHzWIa6kD4hFccMgdvPd1OGy+O6tQCP0as=; 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=1738581983; v=1; x=1738841182; b=XmA6nrchkgnBThehTL/HECa8sRjm2HTlvfB565Qc3GVLD0Gp0e+QUcm08DrGe1y9JMxc8OCY jemsiiz0MJ+HpzdYrf2JeU2GhatyQxJiCt+rWQ3jIz8DYq7ykdKQbK3tDnFJ9knZ/j1pC8RDYjs kgmdv6or/WtHxgCUswedTTrqiC7RyReRZ2y2SrYHqfSrOXKr8HxPYRf+PGAC5Jk7mIY97I1wD9t E7LIZ256MpjLggmSzACK9UeB9NrQToVSZX10eWkkZMQNvq7ZyFiaKrE4oDRkSFLxvArneteEQit rbm72kQWS/IHSRMd5i0wMbCq8N1ls8wOO2zMGrQen9RVw== X-Received: by 127.0.0.2 with SMTP id 4Iv0YY7687511x65aVYAVFjg; Mon, 03 Feb 2025 03:26:22 -0800 X-Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) by mx.groups.io with SMTP id smtpd.web10.85711.1738581981901048737 for ; Mon, 03 Feb 2025 03:26:22 -0800 X-Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 240B81380171; Mon, 3 Feb 2025 06:26:21 -0500 (EST) X-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Mon, 03 Feb 2025 06:26:21 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujeegkecutefuodetggdotefrod 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 06:26:19 -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 v2 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC` Date: Mon, 3 Feb 2025 04:26:04 -0700 Message-ID: <20250203112604.2331684-2-rebecca@bsdio.com> In-Reply-To: <20250203112604.2331684-1-rebecca@bsdio.com> References: <20250203112604.2331684-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 03:26:22 -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: MoOxkW4D1ODYEMATIv1ouJapx7686176AA= 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=XmA6nrch; 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. Bump the revision to 2.4. 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 ++- book.json | 2 +- 4 files changed, 6 insertions(+), 10 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| diff --git a/book.json b/book.json index d112b26e3ebf..a46c487e1b5c 100644 --- a/book.json +++ b/book.json @@ -2,7 +2,7 @@ "variables" : { "draft" : "yes", "title" : "EDK II C Coding Standards Specification", - "version" : "Revision 2.2" + "version" : "Revision 2.4" }, "plugins": ["puml-aleung"], "pluginsConfig": {} -- 2.48.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121067): https://edk2.groups.io/g/devel/message/121067 Mute This Topic: https://groups.io/mt/110968939/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-