> On Nov 19, 2014, at 11:25 AM, Scott Duplichan <sc...@notabs.org> wrote:
> 
> Laszlo Ersek [mailto:ler...@redhat.com] wrote:
> 
> 
> ]On 11/19/14 17:30, Scott Duplichan wrote:
> ]> OvmfPkg: Fix build failure with gcc44, gcc45:
> ]>     OvmfPkg/XenBusDxe/XenHypercall.h:19:31: error: redefinition of typedef 
> 'XENBUS_DEVICE'
> ]>     OvmfPkg/XenBusDxe/XenBusDxe.h:86:31: note: previous declaration of 
> 'XENBUS_DEVICE' was here
> ]> 
> ]> 
> ]> Contributed-under: TianoCore Contribution Agreement 1.0
> ]> Signed-off-by: Scott Duplichan <sc...@notabs.org>
> ]> ---
> ]> 
> ]> Index: OvmfPkg/XenBusDxe/XenHypercall.h
> ]> ===================================================================
> ]> --- OvmfPkg/XenBusDxe/XenHypercall.h       (revision 16406)
> ]> +++ OvmfPkg/XenBusDxe/XenHypercall.h       (working copy)
> ]> @@ -16,8 +16,6 @@
> ]>  #ifndef __XENBUS_DXE_HYPERCALL_H__
> ]>  #define __XENBUS_DXE_HYPERCALL_H__
> ]>  
> ]> -typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
> ]> -
> ]>  /**
> ]>    This function will put the two arguments in the right place (registers) 
> and
> ]>    call HypercallAddr, which correspond to an entry in the hypercall pages.
> ]> 
> ]> 
> ]
> ]Neither of "XenHypercall.h" and "XenBusDxe.h" includes the other,
> ]therefore whichever header file loses the typedef will cause .c files to
> ]break that depend solely on that header file.
> ]
> ]The solution would be to include one of the header files by the other
> ](so that each header file could be included by any .c file in
> ]isolation), or to extract a separate header file with the commonly used
> ]typedef.
> ]
> ]But, I'm beyond caring; any file that includes XenHypercall.h includes
> ]XenBusDxe.h first (as displayed by the gcc error message too):
> ]- EventChannel.c: via EventChannel.h
> ]- GrantTable.c: directly
> ]- XenBusDxe.c: directly
> ]- XenHypercall.c: directly
> ]- XenStore.c: via XenStore.h
> 
> Thanks. I hate to see the code change too much based on supporting
> older compilers, so maybe the current limitation is OK. Apparently
> gcc > 4.5 drops this error (except with -pedantic) because C11 allows
> multiple equivalent typedefs.
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ce3765bf44e49ef0568a1ad4a0b7f807591d6412
> 

The current Xcode (clang) does not like the multiple definitions. If we change 
the rules, we are going to need to change the complier flags for clang. 

In the normal template for edk2 UEFI code does not hit that issue. If we have 
an include that requires defines in another include we usually just include 
that include. 

/Users/andrewfish/work/src/edk2/OvmfPkg/XenBusDxe/XenBusDxe.h:87:31: error: 
redefinition of typedef 'XENBUS_DEVICE' is a C11 feature 
[-Werror,-Wtypedef-redefinition]
typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
                              ^
/Users/andrewfish/work/src/edk2/OvmfPkg/XenBusDxe/XenBusDxe.h:86:31: note: 
previous definition is here
typedef struct _XENBUS_DEVICE XENBUS_DEVICE;


Thanks,

Andrew Fish

> 
> ]... Your patch (from the attachment) has LF line endings; they should be
> ]CRLF. But I can fix that up for you.
> 
> Sorry about the line endings. They are OK on my outbox, so I
> image so helpful server software 'fixed' them for me.
> 
> ]Acked-by: Laszlo Ersek <ler...@redhat.com>
> ]
> ]Committed as r16408.
> ]
> ]Laszlo
> 
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to