diff mbox

[edk2,02/19] Vlv2TbltDevicePkg: Don't define MDEPKG_NDEBUG for gcc

Message ID f69a6e65-2fdb-da38-1e7e-4aca8f5ceda5@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek July 26, 2016, 9:34 a.m. UTC
On 07/26/16 09:18, Gary Lin wrote:
> We enabled "-Wno-unused-but-set-variable" for gcc and it would complain

> that the varible passed to ASSERT_EFI_ERROR wasn't used. Just don't

> define MDEPKG_NDEBUG to make gcc happy with ASSERT_EFI_ERROR.

> 

> Cc: David Wei <david.wei@intel.com>

> CC: Tim He <tim.he@intel.com>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Gary Lin <glin@suse.com>

> ---

>  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 -

>  1 file changed, 1 deletion(-)

> 

> diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc

> index 9865785..e9ce1fc 100644

> --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc

> +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc

> @@ -1091,7 +1091,6 @@ [Components.X64]

>      !endif

>         <BuildOptions>

>          ICC:*_*_*_CC_FLAGS = -D MDEPKG_NDEBUG

> -        GCC:*_*_*_CC_FLAGS = -D MDEPKG_NDEBUG

>    }

>    MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {

>      <LibraryClasses>

> 


"-D MDEPKG_NDEBUG" is fine for RELEASE builds. If you look at "BaseTools/Conf/tools_def.template", the RELEASE_GCC??_*_CC_FLAGS all have "-Wno-unused-but-set-variable", for GCC >= 4.6. Thus, for RELEASE builds, it's not a problem if a Status variable is only ever read with ASSERT_EFI_ERROR(), becuase for RELEASE builds, the warning is suppressed.

See commit 20d00edf21d2f2144921622891d8b59a1553cd83.

So, I recommend a different patch here:


This matches OVMF too.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index 98657851380e..05eb3c698fcc 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -1091,7 +1091,7 @@  [Components.X64]
     !endif
        <BuildOptions>
         ICC:*_*_*_CC_FLAGS = -D MDEPKG_NDEBUG
-        GCC:*_*_*_CC_FLAGS = -D MDEPKG_NDEBUG
+        GCC:RELEASE_*_*_CC_FLAGS = -D MDEPKG_NDEBUG
   }
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
     <LibraryClasses>