diff mbox

[edk2] ShellPkg: UefiHandleParsingLib: remove tautological comparison

Message ID 1467320725-30016-1-git-send-email-lersek@redhat.com
State Accepted
Commit 42cb906852753a081b8458c7f8742e74eeadefd3
Headers show

Commit Message

Laszlo Ersek June 30, 2016, 9:05 p.m. UTC
The code being removed in this patch dates back to git commit a405b86d274d
(Sep 14, 2010; "udk2010.up2.shell initial release."). The condition always
evaluates to true, and it breaks DEBUG builds of ArmVirtPkg with gcc-6.1:

  ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c:
    In function 'ParseHandleDatabaseByRelationshipWithType':
  ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c:2465:76:
    error: self-comparison always evaluates to true
    [-Werror=tautological-compare]
         ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Reported-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Suggested-by: Jaben Carsey <jaben.carsey@intel.com>
Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/13794/focus=13939
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 4 ----
 1 file changed, 4 deletions(-)

-- 
1.8.3.1

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

Comments

Laszlo Ersek June 30, 2016, 9:16 p.m. UTC | #1
On 06/30/16 23:09, Carsey, Jaben wrote:
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


Thank you! Commit 42cb90685275.

Cheers
Laszlo

>> On Jun 30, 2016, at 2:05 PM, Laszlo Ersek <lersek@redhat.com> wrote:

>>

>> The code being removed in this patch dates back to git commit a405b86d274d

>> (Sep 14, 2010; "udk2010.up2.shell initial release."). The condition always

>> evaluates to true, and it breaks DEBUG builds of ArmVirtPkg with gcc-6.1:

>>

>>  ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c:

>>    In function 'ParseHandleDatabaseByRelationshipWithType':

>>  ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c:2465:76:

>>    error: self-comparison always evaluates to true

>>    [-Werror=tautological-compare]

>>         ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);

>>

>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> Cc: Gerd Hoffmann <kraxel@redhat.com>

>> Cc: Jaben Carsey <jaben.carsey@intel.com>

>> Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>

>> Reported-by: Gerd Hoffmann <kraxel@redhat.com>

>> Reported-by: Michael Zimmermann <sigmaepsilon92@gmail.com>

>> Suggested-by: Jaben Carsey <jaben.carsey@intel.com>

>> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/13794/focus=13939

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>> ---

>> ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 4 ----

>> 1 file changed, 4 deletions(-)

>>

>> diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c

>> index b82f925c9218..63710865251d 100644

>> --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c

>> +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c

>> @@ -2460,10 +2460,6 @@ ParseHandleDatabaseByRelationshipWithType (

>>         (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;

>>       } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid)          ) {

>>         (*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE;

>> -      } else {

>> -        DEBUG_CODE_BEGIN();

>> -        ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);

>> -        DEBUG_CODE_END();

>>       }

>>       //

>>       // Retrieve the list of agents that have opened each protocol

>> -- 

>> 1.8.3.1

>>


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

Patch

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index b82f925c9218..63710865251d 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -2460,10 +2460,6 @@  ParseHandleDatabaseByRelationshipWithType (
         (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
       } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid)          ) {
         (*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE;
-      } else {
-        DEBUG_CODE_BEGIN();
-        ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]);
-        DEBUG_CODE_END();
       }
       //
       // Retrieve the list of agents that have opened each protocol