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 044777803CD for ; Tue, 12 Dec 2023 07:17:38 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ZfQiEN+O2fkAh4Et7t6HJ6JxZMHKRh3lyOMSZ3byAdc=; 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; s=20140610; t=1702365457; v=1; b=TtjrXS3M20P4qudotjZBEiGeWlhQ7ZDGyJdP8C3Sqzpz4Y+LSUf4Ky/42AJn0LKHUy62Ku5X +uIYMcbc3krR+w64GXT661ch6joGjrNiBzpIFWdxKm36haxXTTpkKvPvdHlHFybl6A2xOoFAphw SxNggJpKCoEP3aNHEjkOvd4E= X-Received: by 127.0.0.2 with SMTP id 3FmWYY7687511x7A7LjhtkKz; Mon, 11 Dec 2023 23:17:37 -0800 X-Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.groups.io with SMTP id smtpd.web11.9865.1702365456290352313 for ; Mon, 11 Dec 2023 23:17:36 -0800 X-Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3362216835eso1328814f8f.3 for ; Mon, 11 Dec 2023 23:17:36 -0800 (PST) X-Gm-Message-State: HzoMwfvJzWGs9LEdP97f1ytXx7686176AA= X-Google-Smtp-Source: AGHT+IHH2DjhF42T1mWf0fAlpLV7URCTwuKlj/6Vf08ynrov1MUrFkIAWPd5n7jW5OLK5dBNRgqzgPaGEuUVXEtIlAw= X-Received: by 2002:a5d:6846:0:b0:333:4244:48f2 with SMTP id o6-20020a5d6846000000b00333424448f2mr2854481wrw.67.1702365454247; Mon, 11 Dec 2023 23:17:34 -0800 (PST) MIME-Version: 1.0 References: <20231210101859.19198-1-mjsbeaton@gmail.com> <9b333ba1-7ce6-5be7-6482-3aadef7f1973@redhat.com> <12387048-80bf-87db-c15e-55583678863f@redhat.com> <1a51ab01-6a06-af3d-5068-86e6668fd6ec@redhat.com> In-Reply-To: <1a51ab01-6a06-af3d-5068-86e6668fd6ec@redhat.com> From: "Mike Beaton" Date: Tue, 12 Dec 2023 07:17:22 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable unneeded-internal-declaration warning in CLANGPDB To: Laszlo Ersek Cc: devel@edk2.groups.io, Ard Biesheuvel , Ard Biesheuvel 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,mjsbeaton@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=TtjrXS3M; 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 > > A completely different approach, which allows clang to spot that the > > usage has been 'optimised away' and so to not complain (and therefore > > allows us to re-enable the warning in CLANGDWARF as well), is the > > following: > > > > --- a/MdePkg/Include/Library/DebugLib.h > > +++ b/MdePkg/Include/Library/DebugLib.h > > @@ -426,7 +426,10 @@ UnitTestDebugAssert ( > > } \ > > } while (FALSE) > > #else > > -#define DEBUG(Expression) > > +#define DEBUG(Expression) \ > > + if (FALSE) { \ > > + _DEBUG (Expression); \ > > + } > > #endif > > > > /** > > > > But will this not litter the object files with a bunch of format strings > etc? Yes. Which would be optimized away at link time. (Or rather, I believe so, would need further tests to confirm exactly what is optimized away when.) > It feels like, for CLANGPDB (and maybe CLANGDWARF), the RELEASE target > should not define MDEPKG_NDEBUG, but make sure (instead) that > DebugPrintEnabled() evals to FALSE. If PcdDebugPropertyMask is > fixed-at-build, then DebugPrintEnabled() should be possible to evaluate > at compile time; is that right? (At least for clang?) Yes, that is my understanding of how compile-time Pcds work too - but wouldn't the net result be the same as what I suggested? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112358): https://edk2.groups.io/g/devel/message/112358 Mute This Topic: https://groups.io/mt/103087794/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-