]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/UefiShellDebug1CommandsLib: sync Compress() definition with decl.
authorLaszlo Ersek <lersek@redhat.com>
Tue, 6 Feb 2018 21:08:07 +0000 (22:08 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 8 Feb 2018 17:21:11 +0000 (18:21 +0100)
"Compress.h" declares the Compress() function as EFIAPI, but the
definition in "Compress.c" lacks EFIAPI.

GCC toolchains without LTO do not catch this error because "Compress.c"
does not include "Compress.h"; i.e. the declaration used by callers such
as "EfiCompress.c" is not actually matched against the function definition
at build time.

With LTO enabled, the mismatch is found -- however, as a warning only, due
to commit f8d0b9662993 ("BaseTools GCC5: disable warnings-as-errors for
now", 2016-08-03).

Include the header in the C file (which turns the issue into a hard build
error on all GCC toolchains), plus sync the declaration from the header
file to the C file. Finally, remove EFIAPI from both declaration and
definition -- this was the original intent of commit c4e74e9b814c
("ShellPkg/UefiShellDebug1CommandsLib: Remove unnecessary EFIAPI",
2016-10-09), but it missed the header file.

(Gary meant to address that omission in Oct 2017:

  [edk2] [PATCH] ShellPkg/UefiShellDebug1CommandsLib: Remove EFIAPI from
                 Compress()

  http://mid.mail-archive.com/20171026065329.32311-1-glin@suse.com

and Ray reviewed the patch, but then the patch was never committed.)

So do the sync and drop EFIAPI now.

This happens to fix the EFICOMPRESS shell command, when built with GCC for
X64.

Cc: Gary Lin <glin@suse.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Fixes: c4e74e9b814cfb4b51cf832f3bb218cd2aba348b
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c
ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h

index 736d2a35b3ac595de1232f1e533e60ec3d2ff256..cde2c54f1b45edd5ebdfb2de952a544bd56f9c21 100644 (file)
@@ -23,6 +23,8 @@
 #include <Library/DebugLib.h>\r
 #include <Library/ShellLib.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/ShellLib.h>\r
 \r
+#include "Compress.h"\r
+\r
 //\r
 // Macro Definitions\r
 //\r
 //\r
 // Macro Definitions\r
 //\r
@@ -1307,20 +1309,20 @@ Encode (
   The compression routine.\r
 \r
   @param[in]       SrcBuffer     The buffer containing the source data.\r
   The compression routine.\r
 \r
   @param[in]       SrcBuffer     The buffer containing the source data.\r
-  @param[in]       SrcSize       The number of bytes in SrcBuffer.\r
+  @param[in]       SrcSize       Number of bytes in SrcBuffer.\r
   @param[in]       DstBuffer     The buffer to put the compressed image in.\r
   @param[in, out]  DstSize       On input the size (in bytes) of DstBuffer, on\r
   @param[in]       DstBuffer     The buffer to put the compressed image in.\r
   @param[in, out]  DstSize       On input the size (in bytes) of DstBuffer, on\r
-                                return the number of bytes placed in DstBuffer.\r
+                                 return the number of bytes placed in DstBuffer.\r
 \r
   @retval EFI_SUCCESS           The compression was sucessful.\r
   @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.  DstSize is required.\r
 **/\r
 EFI_STATUS\r
 Compress (\r
 \r
   @retval EFI_SUCCESS           The compression was sucessful.\r
   @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.  DstSize is required.\r
 **/\r
 EFI_STATUS\r
 Compress (\r
-  IN       VOID   *SrcBuffer,\r
-  IN       UINT64 SrcSize,\r
-  IN       VOID   *DstBuffer,\r
-  IN OUT   UINT64 *DstSize\r
+  IN      VOID    *SrcBuffer,\r
+  IN      UINT64  SrcSize,\r
+  IN      VOID    *DstBuffer,\r
+  IN OUT  UINT64  *DstSize\r
   )\r
 {\r
   EFI_STATUS  Status;\r
   )\r
 {\r
   EFI_STATUS  Status;\r
index 39a997178fb78526231bd035e7c50b6932f9e730..7fe844e212a87746bef7dbf31fdf3b441851bfe5 100644 (file)
@@ -28,7 +28,6 @@
   @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.  DstSize is required.\r
 **/\r
 EFI_STATUS\r
   @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.  DstSize is required.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 Compress (\r
   IN      VOID    *SrcBuffer,\r
   IN      UINT64  SrcSize,\r
 Compress (\r
   IN      VOID    *SrcBuffer,\r
   IN      UINT64  SrcSize,\r