The -Wempty-body warning for clang does not like an empty for loop that ends in 
);. Placing the ; in the body of the loop removes the warning. Should we fix 
the code or suppress the warning in clang. Note: GCC tends to catch up with 
clang on warnings so we may hit this with other compilers in the future. 

/Users/andrewfish/work/src/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c:682:28:
 error: for loop has empty body [-Werror,-Wempty-body]
           StackPointer ++);
                           ^
/Users/andrewfish/work/src/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c:682:28:
 note: put the semicolon on a separate line to silence this warning
1 error generated.

This code change removes the warning. 
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 7480b66..c563775 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -679,7 +679,8 @@ PeiCheckAndSwitchStack (
       for (StackPointer = (UINT32*)SecCoreData->StackBase;
            (StackPointer < (UINT32*)((UINTN)SecCoreData->StackBase + 
SecCoreData->StackSize)) \
            && (*StackPointer == INIT_CAR_VALUE);
-           StackPointer ++);
+           StackPointer ++)
+         ;
 
         DEBUG ((EFI_D_INFO, "Temp Stack : BaseAddress=0x%p Length=0x%X\n", 
SecCoreData->StackBase, (UINT32)SecCoreData->StackSize));
         DEBUG ((EFI_D_INFO, "Temp Heap  : BaseAddress=0x%p Length=0x%X\n", 
Private->HobList.Raw, (UINT32)((UINTN) 
Private->HobList.HandoffInformationTable->EfiFreeMemoryBottom - (UINTN) 
Private->HobList.Raw)));


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrew Fish <af...@apple.com <mailto:af...@apple.com>>

Thanks,

Andrew Fish

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

Reply via email to