Bug 33822

Summary: REGRESSION(r53273): TransformationMatrix.h needs to use alternative typedef for XFORM when compiling with MinGW
Product: WebKit Reporter: Daniel Bates <dbates>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker CC: aroben, jturcotte, ossy, sfalken, zoltan
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Patch
none
Patch none

Description Daniel Bates 2010-01-18 18:36:08 PST
Changeset 53273 <http://trac.webkit.org/changeset/53273> broke the Qt Windows build when using the MinGW compiler.

In particular, we cannot typedef/forward-declare XFORM in TransformationMatrix.h because this causes a redefinition error with the struct of the same name defined in C:\Qt\2009.05\mingw\include\wingdi.h. Also, the MinGW wingdi.h does not define the macro definition _XFORM_ (like in the Microsoft SDK), so we cannot determine whether this struct is already defined using the preprocessor.

For completeness, the following is a snippet from the build output including the error message:

.\..\JavaScriptCore\pcre" [...] -o obj\debug\SVGElementFactory.o generated\SVG
ElementFactory.cpp
In file included from ..\..\..\WebCore\svg/SVGTransform.h:25,
                 from ..\..\..\WebCore\svg/SVGTransformList.h:26,
                 from ..\..\..\WebCore\svg/SVGTransformable.h:27,
                 from ..\..\..\WebCore\svg/SVGStyledTransformableElement.h:27,
                 from ..\..\..\WebCore\svg/SVGAElement.h:28,
                 from generated\SVGElementFactory.cpp:34:
..\..\..\WebCore\platform\graphics\transforms/TransformationMatrix.h:47: error:
conflicting declaration 'typedef struct tagXFORM XFORM'
c:\qt\2009.05\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/wingdi.h:16
34: error: 'XFORM' has a previous declaration as 'typedef struct _XFORM XFORM'
make[2]: *** [obj/debug/SVGElementFactory.o] Error 1
Comment 1 Daniel Bates 2010-01-18 18:38:33 PST
Created attachment 46877 [details]
Patch

No functionality was changed. So, no new tests.
Comment 2 Mark Rowe (bdash) 2010-01-18 21:04:26 PST
Why on earth would MinGW declare this type in a manner that conflicts with how the Windows API declares it?
Comment 3 Adam Roben (:aroben) 2010-01-19 06:39:50 PST
Comment on attachment 46877 [details]
Patch

We try to avoid including headers from other headers whenever possible, in an effort to reduce code size and compile times. Can we just insert the correct forward-declaration for MinGW as appropriate?
Comment 4 Daniel Bates 2010-01-19 11:27:28 PST
Created attachment 46929 [details]
Patch

Modified the patch based on a conversation with Adam Roben on IRC today (01/19).
Comment 5 Adam Roben (:aroben) 2010-01-19 12:16:49 PST
Comment on attachment 46929 [details]
Patch

r=me
Comment 6 Daniel Bates 2010-01-19 13:05:18 PST
Comment on attachment 46929 [details]
Patch

Clearing flags on attachment: 46929

Committed r53485: <http://trac.webkit.org/changeset/53485>
Comment 7 Daniel Bates 2010-01-19 13:05:25 PST
All reviewed patches have been landed.  Closing bug.