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 0015D94005F for ; Tue, 15 Aug 2023 00:57:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MPhWLYTR7sr97Kan3jAnYYzib9xLXdK6i6U2cg4inBw=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1692061073; v=1; b=Iw5e3pBDuwydoZnq2d6ol5O7gXdVpttb+OxhLLegu+gUwjPSfNdYj6oie0if0ZbIWEVz45e8 EJAzK0IHpyo1thnrIjfbByc37tDpPFaEDsggTE50MjD/duMvwmYgSw5MtM4SmIFh6ZQXjHHZE96 TjKglryreILMnfaGNYzDTnDM= X-Received: by 127.0.0.2 with SMTP id eRIiYY7687511xIXoKazGl4E; Mon, 14 Aug 2023 17:57:53 -0700 X-Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) by mx.groups.io with SMTP id smtpd.web10.124070.1692061072901901335 for ; Mon, 14 Aug 2023 17:57:53 -0700 X-Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-56d263da4f2so3578413eaf.0 for ; Mon, 14 Aug 2023 17:57:52 -0700 (PDT) X-Gm-Message-State: 3gFpVPvF0mWOCuAevsbhRw6Hx7686176AA= X-Google-Smtp-Source: AGHT+IHCXruB7E/S84AmIxm4wRZyI77h3Gw4NcgeVmYNNLlK+xY8HAWI5ht2zzrsxrjvkcsYJ7Ti45RsAQDTaDKpuMs= X-Received: by 2002:a05:6358:9183:b0:134:61a5:7f05 with SMTP id j3-20020a056358918300b0013461a57f05mr11898437rwa.10.1692061072100; Mon, 14 Aug 2023 17:57:52 -0700 (PDT) MIME-Version: 1.0 References: <20230814204859.257-1-mikuback@linux.microsoft.com> In-Reply-To: From: "Pedro Falcato" Date: Tue, 15 Aug 2023 01:57:40 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH v1 0/7] Add DebugMacroCheck To: "Andrew (EFI) Fish" Cc: edk2-devel-groups-io , Michael Kubacki , 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 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,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" 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=Iw5e3pBD; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.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 Tue, Aug 15, 2023 at 1:23=E2=80=AFAM Andrew (EFI) Fish = wrote: > > > > On Aug 14, 2023, at 3:51 PM, Pedro Falcato wrot= e: > > On Mon, Aug 14, 2023 at 9:49=E2=80=AFPM Michael Kubacki > 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 > - Runs on any build target that is not NO-TARGET > - Standalone script: DebugMacroCheck.py > - Run `DebugMacroCheck.py --help` to see command line options > - Unit tests: > - Tests/test_DebugMacroCheck.py > - Can be run with: > `python -m unittest discover -s ./.pytool/Plugin/DebugMacroCheck/tests= -v` > - 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: > > https://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 don't know what MSVC uses, if > anything). > > > I have a dream that we add an eft_print as an attribute format archetype = and then do what you recommend. After all clang and gcc are open source. I don't think the upstream compiler folks are willing to support our broken printf variant. Nor should we encourage things like VOID Foo ( UINTN Val ) { DEBUG ((DEBUG_INFO, "%Lx", (UINT64) Val); } while not providing anything that looks but doesn't look like normal C printf semantics. --=20 Pedro -=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 (#107748): https://edk2.groups.io/g/devel/message/107748 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-