public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Liu, Zhiguang" <zhiguang.liu@intel.com>,
	'Michael Kubacki' <michael.kubacki@microsoft.com>
Subject: Re: [edk2-devel] 回复: [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support reproduce builds
Date: Tue, 2 Nov 2021 07:05:20 +0000	[thread overview]
Message-ID: <CO1PR11MB4929FDE40D1653B132DD7D46D28B9@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <005601d7cf8f$07ab9fc0$1702df40$@byosoft.com.cn>



> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Monday, November 1, 2021 7:12 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; 'Michael Kubacki' <michael.kubacki@microsoft.com>
> Subject: [edk2-devel] 回复: [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support reproduce builds
> 
> Mike:
>   I add my comments.
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: Michael D Kinney <michael.d.kinney@intel.com>
> > 发送时间: 2021年11月2日 5:38
> > 收件人: devel@edk2.groups.io
> > 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Zhiguang Liu
> > <zhiguang.liu@intel.com>; Michael Kubacki
> > <michael.kubacki@microsoft.com>
> > 主题: [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support
> > reproduce builds
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688
> >
> > * Add DEBUG_LINE_NUMBER define to DebugLib.h that is
> >   by default mapped to __LINE__.  A build can define
> >   DEBUG_LINE_NUMBER to use a fixed value.
> > * Add DEBUG_EXPRESSION_STRING(Expression) macros to
> >   DebugLib.h that is by default mapped to #Expression.
> >   A build can define DEBUG_EXPRESSION_STRING_VALUE to
> >   set all expression strings to a fixed string value.
> >
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> > Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> > ---
> >  MdePkg/Include/Library/DebugLib.h | 43
> > ++++++++++++++++++++++++++++---
> >  1 file changed, 39 insertions(+), 4 deletions(-)
> >
> > diff --git a/MdePkg/Include/Library/DebugLib.h
> > b/MdePkg/Include/Library/DebugLib.h
> > index 4cacd4b8e243..7fb75f956c6e 100644
> > --- a/MdePkg/Include/Library/DebugLib.h
> > +++ b/MdePkg/Include/Library/DebugLib.h
> > @@ -71,6 +71,41 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #define EFI_D_VERBOSE   DEBUG_VERBOSE
> >  #define EFI_D_ERROR     DEBUG_ERROR
> >
> > +//
> > +// Source file line number.
> > +// Default is use the to compiler provided __LINE__ macro value. The
> > __LINE__
> > +// mapping can be overriden by predefining DEBUG_LINE_NUMBER
> > +//
> > +// Defining DEBUG_LINE_NUMBER to a fixed value is useful when comparing
> > builds
> > +// across source code formatting changes that may add/remove lines in a
> > source
> > +// file.
> > +//
> > +#ifdef DEBUG_LINE_NUMBER
> > +#else
> > +#define DEBUG_LINE_NUMBER  __LINE__
> > +#endif
> 
> How about #ifndef DEBUG_LINE_NUMBER?

I tried that first.  ECC flags it as an error thinking it is an include  guard macro.
We need to fix ECC to not report this as an error.
This style passes ECC and all EDK II CI tests.

> 
> Thanks
> Liming
> > +
> > +/**
> > +  Macro that converts a Boolean expression to a Null-terminated ASCII
> > string.
> > +
> > +  The default is to use the C pre-processor stringizing operator '#' to
> add
> > +  quotes around the C expression. If DEBUG_EXPRESSION_STRING_VALUE
> > is defined
> > +  then the C expression is converted to the fixed string value.
> > +
> > +  Defining DEBUG_EXPRESSION_STRING_VALUE to a fixed value is useful
> > when
> > +  comparing builds across source code formatting changes that may make
> > +  changes to spaces or parenthesis in a Boolean expression.
> > +
> > +  @param  Expression  Boolean expression.
> > +
> > +**/
> > +
> > +#ifdef DEBUG_EXPRESSION_STRING_VALUE
> > +#define DEBUG_EXPRESSION_STRING(Expression)
> > DEBUG_EXPRESSION_STRING_VALUE
> > +#else
> > +#define DEBUG_EXPRESSION_STRING(Expression)  #Expression
> > +#endif
> > +
> >  /**
> >    Prints a debug message to the debug output device if the specified
> error
> > level is enabled.
> >
> > @@ -310,15 +345,15 @@ UnitTestDebugAssert (
> >    );
> >
> >  #if defined(__clang__) && defined(__FILE_NAME__)
> > -#define _ASSERT(Expression)  UnitTestDebugAssert (__FILE_NAME__,
> > __LINE__, #Expression)
> > +#define _ASSERT(Expression)  UnitTestDebugAssert (__FILE_NAME__,
> > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
> >  #else
> > -#define _ASSERT(Expression)  UnitTestDebugAssert (__FILE__, __LINE__,
> > #Expression)
> > +#define _ASSERT(Expression)  UnitTestDebugAssert (__FILE__,
> > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
> >  #endif
> >  #else
> >  #if defined(__clang__) && defined(__FILE_NAME__)
> > -#define _ASSERT(Expression)  DebugAssert (__FILE_NAME__, __LINE__,
> > #Expression)
> > +#define _ASSERT(Expression)  DebugAssert (__FILE_NAME__,
> > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
> >  #else
> > -#define _ASSERT(Expression)  DebugAssert (__FILE__, __LINE__,
> > #Expression)
> > +#define _ASSERT(Expression)  DebugAssert (__FILE__,
> > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
> >  #endif
> >  #endif
> >
> > --
> > 2.32.0.windows.1
> 
> 
> 
> 
> 
> 
> 
> 
> 


  reply	other threads:[~2021-11-02  7:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 21:37 [Patch V2 0/7] Reproduce builds across source format changes Michael D Kinney
2021-11-01 21:37 ` [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support reproduce builds Michael D Kinney
2021-11-02  2:12   ` 回复: " gaoliming
2021-11-02  7:05     ` Michael D Kinney [this message]
2021-11-04  5:24       ` 回复: [edk2-devel] " gaoliming
2021-11-01 21:37 ` [Patch V2 2/7] MdePkg: Reproduce builds across source format changes Michael D Kinney
2021-11-01 21:37 ` [Patch V2 3/7] ArmPkg: " Michael D Kinney
2021-11-01 21:37 ` [Patch V2 4/7] MdeModulePkg: " Michael D Kinney
2021-11-01 21:37 ` [Patch V2 5/7] NetworkPkg: " Michael D Kinney
2021-11-08 17:09   ` [edk2-devel] " Maciej Rabeda
2021-11-01 21:37 ` [Patch V2 6/7] SecurityPkg: " Michael D Kinney
2021-11-02  0:14   ` Yao, Jiewen
2021-11-01 21:37 ` [Patch V2 7/7] OvmfPkg: " Michael D Kinney
2021-11-05  3:18   ` Yao, Jiewen
2021-11-02  2:31 ` 回复: [Patch V2 0/7] " gaoliming
2021-11-02  7:10   ` Michael D Kinney
2021-11-04  5:15     ` 回复: [edk2-devel] " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB4929FDE40D1653B132DD7D46D28B9@CO1PR11MB4929.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox