From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1C2387803CC for ; Tue, 15 Aug 2023 00:26:25 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cKrxU2De8qfSo4w2dLoaeSoimNEP/12KhxkA6o1wnHc=; 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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1692059184; v=1; b=WOXM8RUyaPLD8ij4mKQ+ffKXVVOfJcaN7op5iLPs/qUz3uGpsALRDuhySIdJrbf96FJW83yw NAN9R9jaZpgYh2aAinA2k9kUJoA84eg01u60Ha+rSWfOnNzX/ApqYahn4KM2W50x0EGY+6eljBo QjlxqoNKxqgrCzkY58p6v/K8= X-Received: by 127.0.0.2 with SMTP id CahpYY7687511xPKCttoybkP; Mon, 14 Aug 2023 17:26:24 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.123667.1692059184163350255 for ; Mon, 14 Aug 2023 17:26:24 -0700 X-Received: from [192.168.4.22] (unknown [47.201.241.95]) by linux.microsoft.com (Postfix) with ESMTPSA id 4C7682109443; Mon, 14 Aug 2023 17:26:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4C7682109443 Message-ID: Date: Mon, 14 Aug 2023 20:26:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 0/7] Add DebugMacroCheck To: devel@edk2.groups.io, afish@apple.com, Pedro Falcato Cc: Abner Chang , Alexei Fedorov , Ard Biesheuvel , Gerd Hoffmann , Igor Kulchytskyy , Jian J Wang , Jiewen Yao , Jordan Justen , Leif Lindholm , Liming Gao , Mike Kinney , Nickle Wang , Pierre Gondois , Sami Mujawar , Sean Brogan References: <20230814204859.257-1-mikuback@linux.microsoft.com> From: "Michael Kubacki" 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 Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: q2OiJdqNY2rc2Cr7IB4FUrVxx7686176AA= 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=20140610 header.b=WOXM8RUy; 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 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 8/14/2023 8:23 PM, Andrew Fish via groups.io wrote: >=20 >=20 >> On Aug 14, 2023, at 3:51 PM, Pedro Falcato =20 >> wrote: >> >> On Mon, Aug 14, 2023 at 9:49=E2=80=AFPM Michael Kubacki >> >=20 >> wrote: >>> >>> From: Michael Kubacki >>> >>> Adds a new script and build plugin called DebugMacroCheck. >>> >>> The script verifies that the number of print specifiers match the >>> number of arguments in DEBUG() calls. >>> >>> Overview: >>> >>> - Build plugin: BuildPlugin/DebugMacroCheckBuildPlugin.py >>> =C2=A0- Runs on any build target that is not NO-TARGET >>> - Standalone script: DebugMacroCheck.py >>> =C2=A0- Run `DebugMacroCheck.py --help` to see command line options >>> - Unit tests: >>> =C2=A0- Tests/test_DebugMacroCheck.py >>> =C2=A0- Can be run with: >>> =C2=A0=C2=A0=C2=A0`python -m unittest discover -s=20 >>> ./.pytool/Plugin/DebugMacroCheck/tests -v` >>> =C2=A0- Also visible in VS Code Test Explorer >>> >>> Background: >>> >>> The tool has been constantly run against edk2 derived code for about >>> a year now. During that time, its found over 20 issues in edk2, over >>> 50 issues in various vendor code, and numerous other issues specific >>> to Project Mu. >>> >>> See the following series for a batch of issues previously fixed in >>> edk2 discovered by the tool: >>> >>> =C2=A0https://edk2.groups.io/g/devel/message/93104 >>> >>> I've received interest from vendors to place it in edk2 to >>> immediately find issues in the upstream and make it easier for edk2 >>> consumers to directly acquire it. That led to this patch series. >>> >>> This would run in edk2 as a build plugin. All issues in the edk2 >>> codebase have been resolved so this would find new issues before >>> they are merged into the codebase. >> >> Hi, >> >> I really like this change but I cannot stop and think that if DEBUG >> and PrintLib were ISO C compliant, we could be using normal interfaces >> with normal argument types and the compiler's intrinsic knowledge of >> printf-like functions. >> Have you explored that option for future code? See e.g >> https://godbolt.org/z/4e8d3WToT (I=20 >> don't know what MSVC uses, if >> anything). >> >=20 > I have a dream that we add an eft_print as an attribute format archetype= =20 > and then do what you recommend. After all clang and gcc are open source. >=20 I agree that would be preferred. I did something in similar in GCC at=20 the time, but I couldn't find an equivalent in VS. The issues kept=20 appearing so this was a cross-platform way to address it. I uploaded some usage examples to the PR for reference: https://github.com/tianocore/edk2/pull/4736 Thanks, Michael > Thanks, >=20 > Andrew Fish >=20 >> -- >> Pedro >> >> >=20 -=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 (#107747): https://edk2.groups.io/g/devel/message/107747 Mute This Topic: https://groups.io/mt/100745693/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-