obsolete

  • Revision slug: VC6_Build_Instructions/diff/obsolete
  • Revision title: obsolete
  • Revision id: 170192
  • Created:
  • Creator: Neil
  • Is current revision? No
  • Comment nsCycleCollector change no longer necessary

Revision Content

These are the patches that used to be required to build trunk with VC6 but are no longer necessary.

  • VC6 doesn't recognise inner classes as friends of outer classes and thus failed to compile nsScriptEventHandlerOwnerTearoff correctly, however as this is now a separate class this friend declaration is now required anyway:
Index: nsXULElement.h
===================================================================
RCS file: /cvsroot/mozilla/content/xul/content/src/nsXULElement.h,v
retrieving revision 1.233
diff -u -r1.233 nsXULElement.h
--- nsXULElement.h	26 Dec 2006 17:47:49 -0000	1.233
+++ nsXULElement.h	30 Dec 2006 16:01:33 -0000
@@ -720,6 +720,7 @@
     private:
         nsRefPtr<nsXULElement> mElement;
     };
+    friend class nsScriptEventHandlerOwnerTearoff;
 };
 
 #endif // nsXULElement_h__
  • VC6 doesn't allow const members of a POD type, and thus failed to compile the initializers for UnitInfo. Fortunately this also confuses the VC7.1 optimizer which is why this patch has since been applied:
Index: nsCSSParser.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSParser.cpp,v
retrieving revision 3.331
diff -u -r3.331 nsCSSParser.cpp
--- nsCSSParser.cpp	12 Dec 2006 15:34:43 -0000	3.331
+++ nsCSSParser.cpp	13 Dec 2006 16:36:41 -0000
@@ -3567,8 +3567,8 @@
 
 
 struct UnitInfo {
-  const char name[5];  // needs to be long enough for the longest unit, with
-                       // terminating null.
+  char name[5];  // needs to be long enough for the longest unit, with
+                 // terminating null.
   PRUint32 length;
   nsCSSUnit unit;
   PRInt32 type;
  • VC6 was unable to compile an nsTArray<nsCOMPtr<nsIFile> > because it appeared to be confused by the use of unions inside the various nsCOMPtr methods. This was only a problem when compiling tests with --enable-debug. However the use of unions was itself an unsafe fix to a strict aliasing fix and this patch has now been applied as the correct fix:
Index: nsCOMPtr.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/glue/nsCOMPtr.cpp,v
retrieving revision 1&
diff -u -r1& nsCOMPtr.cpp
--- nsCOMPtr.cpp	23 Nov 2006 16:10:43 -0000	1&
+++ nsCOMPtr.cpp	31 Dec 2006 10:46:55 -0000
@@ -92,64 +92,64 @@
 void
 nsCOMPtr_base::assign_from_qi( const nsQueryInterface qi, const nsIID& iid )
   {
-    union { nsISupports *mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( helper(iid, &newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( helper(iid, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void**
Index: nsCOMPtr.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/glue/nsCOMPtr.h,v
retrieving revision 1.125
diff -u -r1.125 nsCOMPtr.h
--- nsCOMPtr.h	23 Nov 2006 16:10:43 -0000	1.125
+++ nsCOMPtr.h	31 Dec 2006 10:46:57 -0000
@@ -1240,70 +1240,70 @@
 void
 nsCOMPtr<T>::assign_from_qi( const nsQueryInterface qi, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
 void
 nsCOMPtr<T>::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( helper(aIID, &newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( helper(aIID, &newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template <class T>
@@ -1311,9 +1311,7 @@
 nsCOMPtr<T>::begin_assignment()
   {
     assign_assuming_AddRef(0);
-    union { T** mT; void** mVoid; } result;
-    result.mT = &mRawPtr;
-    return result.mVoid;
+    return NS_REINTERPRET_CAST(void**, &mRawPtr);
   }
 #endif
 
  • VC6 won't let you return a value from a void function. However the nsXFormsContextContainer code needs to port to the branch so the first patch has since been applied on trunk, while the gfxWindowsFonts change has since been obsoleted by further changes to windows font handling:
Index: nsXFormsContextContainer.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsContextContainer.cpp,v
retrieving revision 1.25
diff -u -r1.25 nsXFormsContextContainer.cpp
--- nsXFormsContextContainer.cpp	7 Mar 2007 17:46:57 -0000	1.25
+++ nsXFormsContextContainer.cpp	9 Mar 2007 13:18:26 -0000
@@ -377,7 +377,8 @@
     state = eType_GeneratedContent;
   }
 
-  return nsXFormsControlStub::SetRepeatState(state);
+  nsXFormsControlStub::SetRepeatState(state);
+  return;
 }
 
 // Factory
Index: gfxWindowsFonts.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp,v
retrieving revision 1.85
diff -u -r1.85 gfxWindowsFonts.cpp
--- gfxWindowsFonts.cpp	9 Feb 2007 02:51:06 -0000	1.85
+++ gfxWindowsFonts.cpp	12 Feb 2007 16:18:31 -0000
@@ -631,7 +631,7 @@
     NS_ASSERTION(aStart == 0 && aLength == mLength, "Can't handle substrings");
     SetupSpacingFromProvider(aBreakProvider);
     gfxPoint pt(aPt.x/mAppUnitsPerDevUnit, aPt.y/mAppUnitsPerDevUnit);
-    return mInner.Draw(mContext, pt);
+    mInner.Draw(mContext, pt);
 }
 
 gfxFloat
  • VC6 generates the incorrect symbols for classes that have been incorrectly forward-declared even if they are later defined. This has since been fixed for correctness reasons using this patch:
Index: nsSVGUtils.h
===================================================================
RCS file: /cvsroot/mozilla/layout/svg/base/src/nsSVGUtils.h,v
retrieving revision 1.44
diff -p -u -d -r1.44 nsSVGUtils.h
--- nsSVGUtils.h	5 Feb 2007 20:04:17 -0000	1.44
+++ nsSVGUtils.h	11 Feb 2007 11:31:34 -0000
@@ -71,7 +71,7 @@ class gfxContext;
 class gfxASurface;
 class nsIRenderingContext;
 struct gfxRect;
-class gfxMatrix;
+struct gfxMatrix;
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
  • VC6 uses old-style scoping rules for variables declared in for loops, which makes it unable to compile several functions. However the nsCycleCollector destructor now only has one for loop:
Index: nsCycleCollector.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/base/nsCycleCollector.cpp,v
retrieving revision 1.24
diff -u -r1.24 nsCycleCollector.cpp
--- nsCycleCollector.cpp	19 Mar 2007 23:21:31 -0000	1.24
+++ nsCycleCollector.cpp	20 Mar 2007 09:02:14 -0000
@@ -1385,7 +1385,8 @@
 
     mGraph.Clear();    
 
-    for (PRUint32 i = 0; i < nsIProgrammingLanguage::MAX+1; ++i) {
+    PRUint32 i;
+    for (i = 0; i < nsIProgrammingLanguage::MAX+1; ++i) {
         delete mBufs[i];
         mBufs[i] = NULL;
     }
@@ -1393,7 +1394,7 @@
     delete mRuntimes[nsIProgrammingLanguage::CPLUSPLUS];
     mRuntimes[nsIProgrammingLanguage::CPLUSPLUS] = NULL;
 
-    for (PRUint32 i = 0; i < nsIProgrammingLanguage::MAX+1; ++i) {
+    for (i = 0; i < nsIProgrammingLanguage::MAX+1; ++i) {
         mRuntimes[i] = NULL;
     }
 }

Revision Source

<p>
These are the patches that used to be required to build trunk with VC6 but are no longer necessary.
</p>
<ul><li> VC6 doesn't recognise inner classes as friends of outer classes and thus failed to compile nsScriptEventHandlerOwnerTearoff correctly, however as this is now a separate class this friend declaration is now required anyway:
</li></ul>
<pre class="eval">Index: nsXULElement.h
===================================================================
RCS file: /cvsroot/mozilla/content/xul/content/src/nsXULElement.h,v
retrieving revision 1.233
diff -u -r1.233 nsXULElement.h
--- nsXULElement.h	26 Dec 2006 17:47:49 -0000	1.233
+++ nsXULElement.h	30 Dec 2006 16:01:33 -0000
@@ -720,6 +720,7 @@
     private:
         nsRefPtr&lt;nsXULElement&gt; mElement;
     };
+    friend class nsScriptEventHandlerOwnerTearoff;
 };
 
 #endif // nsXULElement_h__
</pre>
<ul><li> VC6 doesn't allow const members of a POD type, and thus failed to compile the initializers for UnitInfo. Fortunately this also confuses the VC7.1 optimizer which is why this patch has since been applied:
</li></ul>
<pre class="eval">Index: nsCSSParser.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSParser.cpp,v
retrieving revision 3.331
diff -u -r3.331 nsCSSParser.cpp
--- nsCSSParser.cpp	12 Dec 2006 15:34:43 -0000	3.331
+++ nsCSSParser.cpp	13 Dec 2006 16:36:41 -0000
@@ -3567,8 +3567,8 @@
 
 
 struct UnitInfo {
-  const char name[5];  // needs to be long enough for the longest unit, with
-                       // terminating null.
+  char name[5];  // needs to be long enough for the longest unit, with
+                 // terminating null.
   PRUint32 length;
   nsCSSUnit unit;
   PRInt32 type;
</pre>
<ul><li> VC6 was unable to compile an nsTArray&lt;nsCOMPtr&lt;nsIFile&gt; &gt; because it appeared to be confused by the use of unions inside the various nsCOMPtr methods. This was only a problem when compiling tests with --enable-debug. However the use of unions was itself an unsafe fix to a strict aliasing fix and this patch has now been applied as the correct fix:
</li></ul>
<pre class="eval">Index: nsCOMPtr.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/glue/nsCOMPtr.cpp,v
retrieving revision 1&amp;
diff -u -r1&amp; nsCOMPtr.cpp
--- nsCOMPtr.cpp	23 Nov 2006 16:10:43 -0000	1&amp;
+++ nsCOMPtr.cpp	31 Dec 2006 10:46:55 -0000
@@ -92,64 +92,64 @@
 void
 nsCOMPtr_base::assign_from_qi( const nsQueryInterface qi, const nsIID&amp; iid )
   {
-    union { nsISupports *mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_qi_with_error( const nsQueryInterfaceWithError&amp; qi, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&amp; gs, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&amp; gs, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void
 nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper&amp; helper, const nsIID&amp; iid )
   {
-    union { nsISupports* mSupports; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( helper(iid, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mSupports = 0;
-    assign_assuming_AddRef(newRawPtr.mSupports);
+    void* newRawPtr;
+    if ( NS_FAILED( helper(iid, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(nsISupports*, newRawPtr));
   }
 
 void**
Index: nsCOMPtr.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/glue/nsCOMPtr.h,v
retrieving revision 1.125
diff -u -r1.125 nsCOMPtr.h
--- nsCOMPtr.h	23 Nov 2006 16:10:43 -0000	1.125
+++ nsCOMPtr.h	31 Dec 2006 10:46:57 -0000
@@ -1240,70 +1240,70 @@
 void
 nsCOMPtr&lt;T&gt;::assign_from_qi( const nsQueryInterface qi, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_qi_with_error( const nsQueryInterfaceWithError&amp; qi, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( qi(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( qi(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&amp; gs, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&amp; gs, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( gs(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( gs(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
 void
 nsCOMPtr&lt;T&gt;::assign_from_helper( const nsCOMPtr_helper&amp; helper, const nsIID&amp; aIID )
   {
-    union { T* mT; void *mVoid; } newRawPtr;
-    if ( NS_FAILED( helper(aIID, &amp;newRawPtr.mVoid) ) )
-      newRawPtr.mT = 0;
-    assign_assuming_AddRef(newRawPtr.mT);
+    void* newRawPtr;
+    if ( NS_FAILED( helper(aIID, &amp;newRawPtr) ) )
+      newRawPtr = 0;
+    assign_assuming_AddRef(NS_STATIC_CAST(T*, newRawPtr));
   }
 
 template &lt;class T&gt;
@@ -1311,9 +1311,7 @@
 nsCOMPtr&lt;T&gt;::begin_assignment()
   {
     assign_assuming_AddRef(0);
-    union { T** mT; void** mVoid; } result;
-    result.mT = &amp;mRawPtr;
-    return result.mVoid;
+    return NS_REINTERPRET_CAST(void**, &amp;mRawPtr);
   }
 #endif
 
</pre>
<ul><li> VC6 won't let you return a value from a void function. However the nsXFormsContextContainer code needs to port to the branch so the first patch has since been applied on trunk, while the gfxWindowsFonts change has since been obsoleted by further changes to windows font handling:
</li></ul>
<pre class="eval">Index: nsXFormsContextContainer.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsContextContainer.cpp,v
retrieving revision 1.25
diff -u -r1.25 nsXFormsContextContainer.cpp
--- nsXFormsContextContainer.cpp	7 Mar 2007 17:46:57 -0000	1.25
+++ nsXFormsContextContainer.cpp	9 Mar 2007 13:18:26 -0000
@@ -377,7 +377,8 @@
     state = eType_GeneratedContent;
   }
 
-  return nsXFormsControlStub::SetRepeatState(state);
+  nsXFormsControlStub::SetRepeatState(state);
+  return;
 }
 
 // Factory
</pre>
<pre class="eval">Index: gfxWindowsFonts.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp,v
retrieving revision 1.85
diff -u -r1.85 gfxWindowsFonts.cpp
--- gfxWindowsFonts.cpp	9 Feb 2007 02:51:06 -0000	1.85
+++ gfxWindowsFonts.cpp	12 Feb 2007 16:18:31 -0000
@@ -631,7 +631,7 @@
     NS_ASSERTION(aStart == 0 &amp;&amp; aLength == mLength, "Can't handle substrings");
     SetupSpacingFromProvider(aBreakProvider);
     gfxPoint pt(aPt.x/mAppUnitsPerDevUnit, aPt.y/mAppUnitsPerDevUnit);
-    return mInner.Draw(mContext, pt);
+    mInner.Draw(mContext, pt);
 }
 
 gfxFloat
</pre>
<ul><li> VC6 generates the incorrect symbols for classes that have been incorrectly forward-declared even if they are later defined. This has since been fixed for correctness reasons using this patch:
</li></ul>
<pre class="eval">Index: nsSVGUtils.h
===================================================================
RCS file: /cvsroot/mozilla/layout/svg/base/src/nsSVGUtils.h,v
retrieving revision 1.44
diff -p -u -d -r1.44 nsSVGUtils.h
--- nsSVGUtils.h	5 Feb 2007 20:04:17 -0000	1.44
+++ nsSVGUtils.h	11 Feb 2007 11:31:34 -0000
@@ -71,7 +71,7 @@ class gfxContext;
 class gfxASurface;
 class nsIRenderingContext;
 struct gfxRect;
-class gfxMatrix;
+struct gfxMatrix;
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
</pre>
<ul><li> VC6 uses old-style scoping rules for variables declared in for loops, which makes it unable to compile several functions. However the nsCycleCollector destructor now only has one for loop:
</li></ul>
<pre class="eval">Index: nsCycleCollector.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/base/nsCycleCollector.cpp,v
retrieving revision 1.24
diff -u -r1.24 nsCycleCollector.cpp
--- nsCycleCollector.cpp	19 Mar 2007 23:21:31 -0000	1.24
+++ nsCycleCollector.cpp	20 Mar 2007 09:02:14 -0000
@@ -1385,7 +1385,8 @@
 
     mGraph.Clear();    
 
-    for (PRUint32 i = 0; i &lt; nsIProgrammingLanguage::MAX+1; ++i) {
+    PRUint32 i;
+    for (i = 0; i &lt; nsIProgrammingLanguage::MAX+1; ++i) {
         delete mBufs[i];
         mBufs[i] = NULL;
     }
@@ -1393,7 +1394,7 @@
     delete mRuntimes[nsIProgrammingLanguage::CPLUSPLUS];
     mRuntimes[nsIProgrammingLanguage::CPLUSPLUS] = NULL;
 
-    for (PRUint32 i = 0; i &lt; nsIProgrammingLanguage::MAX+1; ++i) {
+    for (i = 0; i &lt; nsIProgrammingLanguage::MAX+1; ++i) {
         mRuntimes[i] = NULL;
     }
 }
</pre>
Revert to this revision