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 997D874003D for ; Mon, 21 Oct 2024 20:05:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FjmBkhVL2iJsTN3irHB/MiYD15+QCSwstmb7Sg4r3/A=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240830; t=1729541152; v=1; x=1729800351; b=YYQw9SimeihKaKw9NY9BLZYT8PjhwYJIamfSSQx7jrKnc4ij+l5ITHGgoXLq/vTuFKK8SFJb m7voKjcUUh/VAKf3PC1sJCxZ7NaCtPgF8rF2nSpBoYbdco330A1sHySDfEtNobYaQWf8V0/U0ll XSnQacU+nKSRjKYjJdaNBEEsBh87c5Xm+LSmdwL62bKtAglYoX9BpXpbA8igDE4fFGAynzmBqCa X1T2DuSzJtbPB3HAg+/B4FtVtFX4SKoCNGl4dSV2cEAow0bUvf/iLLgSN04RXMPxtLBoJqe9XlO qeilp+2qgqS5hiTgEVWtQ9tb5yKwk0k+e9FTCdH+Zk66w== X-Received: by 127.0.0.2 with SMTP id fpWiYY7687511x8c3YUb8S2D; Mon, 21 Oct 2024 13:05:51 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.2017.1729541150554222708 for ; Mon, 21 Oct 2024 13:05:50 -0700 X-Received: from [10.137.194.171] (unknown [131.107.159.43]) by linux.microsoft.com (Postfix) with ESMTPSA id F392C210D874; Mon, 21 Oct 2024 13:05:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F392C210D874 Message-ID: <591659ac-1d4a-43bd-b953-1032e5a7b8b0@linux.microsoft.com> Date: Mon, 21 Oct 2024 13:05:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC` To: devel@edk2.groups.io, pedro.falcato@gmail.com, rebecca@bsdio.com Cc: "Kinney, Michael D" References: <20241011012040.274642-1-rebecca@bsdio.com> From: "Oliver Smith-Denny" In-Reply-To: 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, 21 Oct 2024 13:05:50 -0700 Resent-From: osde@linux.microsoft.com Reply-To: devel@edk2.groups.io,osde@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: por0hSNM2SkhT87URAJK9JbGx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=YYQw9Sim; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=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 On 10/21/2024 12:42 PM, Pedro Falcato wrote: > On Mon, Oct 21, 2024 at 3:49=E2=80=AFPM Rebecca Cran via groups.io > wrote: >> >> Thanks, I'll fix it. >> >> Could you confirm whether the change from STATIC to static is something >> we want to go ahead with, or do we want to keep STATIC to allow >> GoogleTest to work? >=20 > You don't need STATIC, doing stuff like -Dstatic=3D (or just #define > static in C code) Just Works. For GCC at least. >=20 > proof of horribleness: https://godbolt.org/z/EvMd6hev8 >=20 The issue here is that C uses one keyword for two distinct things: file private members and local variables that keep state across calls, i.e. real static variables. If you only have static, then #define static , you'll mess up the local variable case under test. Don't get me wrong, I think all of this tinkering is horribleness and I think that mixing languages often brings these kind of compromises, which is unfortunate. I'm not advocating we introduce these kind of hacks, but I do think we should be able to unit test static functions, so I'd like to see a solution for that, which again, might just be CMocka. Oliver -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120638): https://edk2.groups.io/g/devel/message/120638 Mute This Topic: https://groups.io/mt/108941574/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-