[edk2-devel] [PATCH v3 6/7] MdeModulePkg/PeCoffImageEmulator: avoid redeclaration of typedef

Ard Biesheuvel ard.biesheuvel at linaro.org
Fri May 31 12:49:57 UTC 2019


The usual pattern of defining a protocol in EDK2 is

  typedef struct _FOO_PROTOCOL FOO_PROTOCOL;

  <definitions of protocol methods referring to FOO_PROTOCOL>

  struct _FOO_PROTOCOL {
    <method 1>
    <method 2>
    ...
   };

However, in the definition of EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL,
we are deviating from this for no good reason, and instead, the
struct definition is combined with a redefinition of the first
typedef, and this is not permitted before C11.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
---
 MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
index 29633e9a8ed4..9ea080eefb56 100644
--- a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
+++ b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
@@ -91,7 +91,7 @@ EFI_STATUS
 
 #define EDKII_PECOFF_IMAGE_EMULATOR_VERSION         0x1
 
-typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
+struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
   EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED    IsImageSupported;
   EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE        RegisterImage;
   EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE      UnregisterImage;
@@ -100,7 +100,7 @@ typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
   UINT32                                            Version;
   // The machine type implemented by the emulator
   UINT16                                            MachineType;
-} EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
+};
 
 extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid;
 
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41741): https://edk2.groups.io/g/devel/message/41741
Mute This Topic: https://groups.io/mt/31879994/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list