[edk2-devel] [PATCH v3 7/7] MdePkg: avoid redeclaration of typedefs

Ard Biesheuvel ard.biesheuvel at linaro.org
Fri May 31 12:49:58 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 EFI_HII_POPUP_PROTOCOL and
EFI_RESET_NOTIFICATION_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>
---
 MdePkg/Include/Protocol/HiiPopup.h          | 4 ++--
 MdePkg/Include/Protocol/ResetNotification.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/Protocol/HiiPopup.h b/MdePkg/Include/Protocol/HiiPopup.h
index e8161c3701ad..d7be784723b8 100644
--- a/MdePkg/Include/Protocol/HiiPopup.h
+++ b/MdePkg/Include/Protocol/HiiPopup.h
@@ -67,10 +67,10 @@ EFI_STATUS
   OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
 );
 
-typedef struct _EFI_HII_POPUP_PROTOCOL {
+struct _EFI_HII_POPUP_PROTOCOL {
   UINT64                Revision;
   EFI_HII_CREATE_POPUP  CreatePopup;
-} EFI_HII_POPUP_PROTOCOL;
+};
 
 extern EFI_GUID gEfiHiiPopupProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/ResetNotification.h b/MdePkg/Include/Protocol/ResetNotification.h
index 1142424e4610..b9aa321f639a 100644
--- a/MdePkg/Include/Protocol/ResetNotification.h
+++ b/MdePkg/Include/Protocol/ResetNotification.h
@@ -68,10 +68,10 @@ EFI_STATUS
   IN EFI_RESET_SYSTEM                ResetFunction
 );
 
-typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL {
+struct _EFI_RESET_NOTIFICATION_PROTOCOL {
   EFI_REGISTER_RESET_NOTIFY   RegisterResetNotify;
   EFI_UNREGISTER_RESET_NOTIFY UnregisterResetNotify;
-} EFI_RESET_NOTIFICATION_PROTOCOL;
+};
 
 
 extern EFI_GUID gEfiResetNotificationProtocolGuid;
-- 
2.20.1


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

View/Reply Online (#41742): https://edk2.groups.io/g/devel/message/41742
Mute This Topic: https://groups.io/mt/31879995/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