Revision: 15812
          http://sourceforge.net/p/edk2/code/15812
Author:   jljusten
Date:     2014-08-16 16:18:53 +0000 (Sat, 16 Aug 2014)
Log Message:
-----------
MdePkg: BaseOrderedCollectionRedBlackTreeLib: silence invalid gcc warning

Gcc-4.4 reports the following build failure:

  BaseOrderedCollectionRedBlackTreeLib.c:
    In function 'OrderedCollectionInsert':
  BaseOrderedCollectionRedBlackTreeLib.c:586:
    error: 'Result' may be used uninitialized in this function

This is incorrect. There are two areas of use of Result to consider:

- In the very first while loop. The warning is likely not about this code
  area, because Result is assigned directly before use.

- The last use of Result in the function. The build warning / error is
  incorrect. For Result to be uninitialized at that point, the very first
  while loop must not have been entered at all (because that loop assigns
  a value to Result). However, if that loop is never entered, then Parent
  is still NULL. And Parent==NULL implies that the use of Result is never
  reached, because we jump to the Done label just before it.

Assign an irrelevant value of 0 to Result at the beginning of the function
in order to silence the incorrect warning.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c

Modified: 
trunk/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
===================================================================
--- 
trunk/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
       2014-08-15 08:10:55 UTC (rev 15811)
+++ 
trunk/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
       2014-08-16 16:18:53 UTC (rev 15812)
@@ -589,6 +589,7 @@
 
   Tmp = Tree->Root;
   Parent = NULL;
+  Result = 0;
 
   //
   // First look for a collision, saving the last examined node for the case

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to