Bug 56198

Summary: WebCore/loader/appcache/ApplicationCacheGroup fails to compile on S10/SS12
Product: WebKit Reporter: Ben Taylor <bentaylor.solx86>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Other   
Attachments:
Description Flags
Proposed patch which compiles correctly in qt-4.7.1 with webkit enabled on Solaris 10 with SS12 C++ compiler none

Description Ben Taylor 2011-03-11 08:58:37 PST
qt-everywhere-opensource-src-4.7.1/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp

Solaris 10, Sun Studio 12 (SS12) C++ compiler


   767          ASSERT(m_cacheBeingUpdated);
   768          if (m_manifestResource)
   769              m_cacheBeingUpdated->setManifestResource(m_manifestResource.release());
   770          else {
   771              // We can get here as a result of retrying the Complete step, following
   772              // a failure of the cache storage to save the newest cache due to hitting
   773              // the maximum size. In such a case, m_manifestResource may be 0, as
   774              // the manifest was already set on the newest cache object.
   775              ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize);
   776          }
   777
   778          RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache;
   779

"loader/appcache/ApplicationCache.cpp", line 778: Error: Ambiguous "?:" expression, second operand of type "int" and third operand of type "WTF::RefPtr<WebCore::ApplicationCache>" can be converted to one another.

The Sun Studio 12 C++ compiler does not like having to accept 0 untyped when the other conditional is typed.

The following patch makes the compilation error go away.

--- qt-everywhere-opensource-src-4.7.1/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp.ORIG       2011-03-09 15:16:41.124515331
+0000
+++ qt-everywhere-opensource-src-4.7.1/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp    2011-03-09 14:50:54.718120159 +0000
@@ -775,7 +775,7 @@
             ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize);
         }

-        RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache;
+        RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>() : m_newestCache;

         setNewestCache(m_cacheBeingUpdated.release());
         if (cacheStorage().storeNewestCache(this)) {
Comment 1 Alexey Proskuryakov 2011-03-11 11:44:20 PST
I would suggest replacing the ?: with an if instead.

Please see <http://www.webkit.org/coding/contributing.html> for information about contributing code to WebKit.
Comment 2 Ben Taylor 2011-03-11 14:30:20 PST
Created attachment 85534 [details]
Proposed patch which compiles correctly in qt-4.7.1 with webkit enabled on Solaris 10 with SS12 C++ compiler

This fix is against webkit head, but works for the webkit distributed with qt-4.7.1.  Other attempts to structure the patch as an if/then clause were unsuccessful.
Comment 3 Alexey Proskuryakov 2011-03-11 14:52:04 PST
Comment on attachment 85534 [details]
Proposed patch which compiles correctly in qt-4.7.1 with webkit enabled on Solaris 10 with SS12 C++ compiler

OK. Some of the EWS bots are badly lagging, but for this kind of change, its enough that a few of them are green. Commit queue should land this automatically in a day or two.
Comment 4 WebKit Commit Bot 2011-03-11 16:34:15 PST
Comment on attachment 85534 [details]
Proposed patch which compiles correctly in qt-4.7.1 with webkit enabled on Solaris 10 with SS12 C++ compiler

Clearing flags on attachment: 85534

Committed r80903: <http://trac.webkit.org/changeset/80903>
Comment 5 WebKit Commit Bot 2011-03-11 16:34:20 PST
All reviewed patches have been landed.  Closing bug.