Bug 58725 - Fix compilation on Solaris 10 with Sun Studio 12: ternary opertors must have matching types
Summary: Fix compilation on Solaris 10 with Sun Studio 12: ternary opertors must have ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-16 00:11 PDT by Ben Taylor
Modified: 2011-04-21 12:27 PDT (History)
2 users (show)

See Also:


Attachments
Patch to fix the mis-matched types in a ternary operation on Solaris 10 with Sun Studio 12 (8.63 KB, patch)
2011-04-16 00:45 PDT, Ben Taylor
no flags Details | Formatted Diff | Diff
Fix compilation on Solaris 10 with Sun Studio 12, ternary operators must match types, updated. (7.15 KB, patch)
2011-04-17 04:03 PDT, Ben Taylor
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Taylor 2011-04-16 00:11:12 PDT
Solaris Studio 12 Compilers on Solaris 10 enforce strong type checking on ternary operators:

Error: Ambiguous "?:" expression, second operand of type "WTF::PassRefPtr<WebCore::DocumentFragment>" and third operand of type "int" can be converted to one another.
Error: Ambiguous "?:" expression, second operand of type "WTF::PassRefPtr<JSC::Label>" and third operand of type "int" can be converted to one another.
[and others similar]
Comment 1 Ben Taylor 2011-04-16 00:45:44 PDT
Created attachment 89918 [details]
Patch to fix the mis-matched types in a ternary operation on Solaris 10 with Sun Studio 12

A compile fix for Solaris 10 with Sun Studio 12 CC compiler, ternary operators must have matching types.
Comment 2 Alexey Proskuryakov 2011-04-16 23:24:17 PDT
Comment on attachment 89918 [details]
Patch to fix the mis-matched types in a ternary operation on Solaris 10 with Sun Studio 12

-    LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>()); // Only loops have continue targets.
+    LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>(0)); // Only loops have continue targets.

I don't see this change explained - types already match here.
Comment 3 Ben Taylor 2011-04-17 04:03:12 PDT
Created attachment 89947 [details]
Fix compilation on Solaris 10 with Sun Studio 12, ternary operators must match types, updated.

Updated patch per review (good catch).
Comment 4 Eric Seidel (no email) 2011-04-18 10:02:36 PDT
Is there not a newer compiler than this one?  Does GCC work on Solaris?  This particular compiler seems über-lame.
Comment 5 Ben Taylor 2011-04-18 10:19:44 PDT
(In reply to comment #4)
> Is there not a newer compiler than this one?  Does GCC work on Solaris?  This particular compiler seems über-lame.

gcc has a different ABI from Sun Studio 12/12.1/12.2, which means we either build QT/WebKit/KDE4 from gcc or Sun Studio.  Studio happens to be a more stict compiler.  I can't use 12.2 because there are compiler failures which are not fixed when compiling QT.    The other problem is that unless one has a support contract with Oracle, you can't get the Studio patches for free anymore, and I've been able to build QT/WebKit/KDE4 with SS12 and have it work.  Testing the SS12.1 compiler is going to be challenging, because it is a new compiler, not an update of the SS12 compiler. So, new set of bugs.

I have 2-3 more Solaris/Studio patches which I will be submitting, then we should be done for a while.
Comment 6 WebKit Commit Bot 2011-04-21 12:27:44 PDT
Comment on attachment 89947 [details]
Fix compilation on Solaris 10 with Sun Studio 12, ternary operators must match types, updated.

Clearing flags on attachment: 89947

Committed r84538: <http://trac.webkit.org/changeset/84538>
Comment 7 WebKit Commit Bot 2011-04-21 12:27:49 PDT
All reviewed patches have been landed.  Closing bug.