From nobody Tue May 14 21:15:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112492+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112492+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1702508894; cv=none; d=zohomail.com; s=zohoarc; b=hECyFpjSQA70jD8rUvL0Oe3ioW7LUpU79d+1fSHSavoKcV5Eg7E1vX9ncGdoaOA07vx9qT97XB9YU8vrbF4flG63TaYXB/rF+qmRLcZfdRNuKF2iyItQacOECmXi5i7vUsL+kFj2eSfquNA5x0SE0dccYo6iUmhPfw9JrzF9wRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702508894; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=4bcpQocwCo3a2s4gv0mEzQ1A7hRhCzBtqnE1J0dctw0=; b=UsB1D1AA3JDIiMnJlwqRTdhRA9cXZJm38KnRSSSvoBQAAQpoUpnruJRW0RtyJfAcJnk+gxe4GIssEakou5cZ/lOOxnHWclaTXKh7rmG7I8FmLgtgEHzutnI6rpTueXoX0ul6+PLXusL0V2tK3c4yusL6oHIDyswkU9ubdTyxlbg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112492+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1702508894909548.85292020351; Wed, 13 Dec 2023 15:08:14 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=JUFgCA62ej/8ro/+ahtv8u9yu7QODtsB43ZMK7qL2Hs=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1702508894; v=1; b=NVBsUU0oCKfrYaNeAefoNkxM3RHHpPooNwikgHGEmDqZbQQhXuymAMTRPGJ1oNgDCy3uQWWG AImnD1WsvG9+5umgK1TGYv9OD0+4+oM783DDWGtSYYEY+5xqBF5zMIo6COsbigOSBjfEsBciyx6 BJH7n480Cw9p4UdYAnXplTCg= X-Received: by 127.0.0.2 with SMTP id jwfdYY1788612xr1oqur8NCP; Wed, 13 Dec 2023 15:08:14 -0800 X-Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by mx.groups.io with SMTP id smtpd.web11.3597.1702508893458746464 for ; Wed, 13 Dec 2023 15:08:13 -0800 X-Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-54c67b0da54so9582529a12.0 for ; Wed, 13 Dec 2023 15:08:13 -0800 (PST) X-Gm-Message-State: ZAfNbowhCqB9LNkQ3ktYyVtIx1787277AA= X-Google-Smtp-Source: AGHT+IF4wC+svdMqxpsmULL+L56BT5RtlCO3BCqoKNt7mX6IElolNU1c2Yvfc6SRC5fEnjEf5Ap9bw== X-Received: by 2002:a17:906:41:b0:a23:b67:cb1b with SMTP id 1-20020a170906004100b00a230b67cb1bmr153312ejg.17.1702508891120; Wed, 13 Dec 2023 15:08:11 -0800 (PST) X-Received: from mikes-OptiPlex-3070.. (82-132-217-211.dab.02.net. [82.132.217.211]) by smtp.gmail.com with ESMTPSA id cw15-20020a170907160f00b00a1937153bddsm8407650ejd.20.2023.12.13.15.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:08:10 -0800 (PST) From: "Mike Beaton" To: devel@edk2.groups.io Cc: ardb@google.com, lersek@redhat.com, Mike Beaton Subject: [edk2-devel] [PATCH V3] DebugLib: Update DEBUG macro used when MDEPKG_NDEBUG is defined Date: Wed, 13 Dec 2023 23:07:42 +0000 Message-Id: <20231213230741.168859-1-mjsbeaton@gmail.com> MIME-Version: 1.0 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1702508896185100003 Content-Type: text/plain; charset="utf-8" From: Mike Beaton The variant provided when MDEPKG_NDEBUG is defined will be optimised away in RELEASE builds, but by referencing the argument list, avoids unused variable errors from valid debug code, for example when STATIC variables are used only in DEBUG statements. Signed-off-by: Mike Beaton --- BaseTools/Conf/tools_def.template | 2 +- MdePkg/Include/Library/DebugLib.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index c34ecfd557..eaccf0b698 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1859,7 +1859,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS =3D -Wl,--d= efsym=3DPECOFF_HEADER_SIZE=3D0x22 DEFINE CLANGDWARF_IA32_TARGET =3D -target i686-pc-linux-gnu DEFINE CLANGDWARF_X64_TARGET =3D -target x86_64-pc-linux-gnu =20 -DEFINE CLANGDWARF_WARNING_OVERRIDES =3D -Wno-parentheses-equality -Wno-= empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-opt= ion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-= access -Wno-unneeded-internal-declaration +DEFINE CLANGDWARF_WARNING_OVERRIDES =3D -Wno-parentheses-equality -Wno-= empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-opt= ion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-= access DEFINE CLANGDWARF_ALL_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) DEF(CLA= NGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address= -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-r= edeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float= -mno-implicit-float -ftrap-function=3Dundefined_behavior_has_been_optimiz= ed_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference =20 ########################### diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/Deb= ugLib.h index 40772f2e0f..bc7789f01c 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -426,7 +426,12 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else -#define DEBUG(Expression) +#define DEBUG(Expression) \ + do { \ + if (FALSE) { \ + _DEBUG (Expression); \ + } \ + } while (FALSE) #endif =20 /** --=20 2.39.2 -=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 (#112492): https://edk2.groups.io/g/devel/message/112492 Mute This Topic: https://groups.io/mt/103160238/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-