public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: Mikhail Krichanov <krichanov@ispras.ru>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	Vitaly Cheptsov <vit9696@protonmail.com>
Subject: Re: [PATCH] MdePkg: DebugLib: Compilation fix for clang-13.
Date: Fri, 19 Nov 2021 16:51:35 +0000	[thread overview]
Message-ID: <CO1PR11MB492995ACADD5A2B008627C44D29C9@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211119090529.2865-1-krichanov@ispras.ru>

Hi Mikhail,

For RELEASE GCC5 toolchains in tools_def.txt, I see this warning is disabled.  Likely for the same reason.

RELEASE_GCC5_IA32_CC_FLAGS       = DEF(GCC5_IA32_CC_FLAGS) -flto -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
RELEASE_GCC5_X64_CC_FLAGS        = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
RELEASE_GCC5_ARM_CC_FLAGS        = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable

I think it would be better to ignore the same warning in RELEASE CLANG38 tool chains with an update to tools_def.txt instead of DebugLib.h.

Unless you are thinking that disabling this warning is hiding some bad code practices that need to be cleaned up.

Best regards,

Mike


> -----Original Message-----
> From: Mikhail Krichanov <krichanov@ispras.ru>
> Sent: Friday, November 19, 2021 1:05 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Vitaly Cheptsov <vit9696@protonmail.com>; Mikhail Krichanov <krichanov@ispras.ru>
> Subject: [PATCH] MdePkg: DebugLib: Compilation fix for clang-13.
> 
> build -a X64 -t CLANG38 -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
> results in
> UDK/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c:1284:31:
> error: variable 'Status' set but not used [-Werror,-Wunused-but-set-variable]
>   EFI_STATUS                  Status;
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3704
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
> Signed-off-by: Mikhail Krichanov <krichanov@ispras.ru>
> ---
>  MdePkg/Include/Library/DebugLib.h | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
> index 4cacd4b8..7785e99d 100644
> --- a/MdePkg/Include/Library/DebugLib.h
> +++ b/MdePkg/Include/Library/DebugLib.h
> @@ -370,7 +370,10 @@ UnitTestDebugAssert (
>        }                             \
>      } while (FALSE)
>  #else
> -  #define ASSERT(Expression)
> +  #define ASSERT(Expression)       \
> +    do {                           \
> +      (VOID) (Expression);         \
> +    } while (FALSE)
>  #endif
> 
>  /**
> @@ -392,6 +395,14 @@ UnitTestDebugAssert (
>          _DEBUG (Expression);       \
>        }                            \
>      } while (FALSE)
> +#elif defined(__GNUC__) || defined(__clang__)
> +  #define DEBUG(Expression)                                \
> +    do {                                                   \
> +      _Pragma("GCC diagnostic push")                       \
> +      _Pragma("GCC diagnostic ignored \"-Wunused-value\"") \
> +      (VOID) Expression;                                   \
> +      _Pragma("GCC diagnostic pop")                        \
> +    } while (FALSE)
>  #else
>    #define DEBUG(Expression)
>  #endif
> @@ -419,7 +430,10 @@ UnitTestDebugAssert (
>        }                                                                                  \
>      } while (FALSE)
>  #else
> -  #define ASSERT_EFI_ERROR(StatusParameter)
> +  #define ASSERT_EFI_ERROR(StatusParameter)                                             \
> +    do {                                                                                \
> +      (VOID) (StatusParameter);                                                         \
> +    } while (FALSE)
>  #endif
> 
>  /**
> @@ -446,7 +460,10 @@ UnitTestDebugAssert (
>        }                                                                 \
>      } while (FALSE)
>  #else
> -  #define ASSERT_RETURN_ERROR(StatusParameter)
> +  #define ASSERT_RETURN_ERROR(StatusParameter)                          \
> +    do {                                                                \
> +      (VOID) (StatusParameter);                                         \
> +    } while (FALSE)
>  #endif
> 
>  /**
> --
> 2.20.1

       reply	other threads:[~2021-11-19 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211119090529.2865-1-krichanov@ispras.ru>
2021-11-19 16:51 ` Michael D Kinney [this message]
     [not found]   ` <db6fe4e5b31c28a6bcdb1f189cfcd5b1@ispras.ru>
2021-11-22 16:42     ` [PATCH] MdePkg: DebugLib: Compilation fix for clang-13 Michael D Kinney
2021-11-22 23:17       ` [edk2-devel] " Michael Brown
2021-11-23  6:41         ` Marvin Häuser
2021-11-23 11:40           ` Michael Brown

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=CO1PR11MB492995ACADD5A2B008627C44D29C9@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