Unable to build Firefox 1.5.0.2 on Solaris 9

Greg Earle <[email protected]> Wed, 19 Apr 2006 09:51:20 -0700
Newsgroups gmane.comp.mozilla.devel.unix
Message-ID <2006041909512016807-earleNOSPAM@NOSPAMisolarNOSPAMDynDNSNOSPAMORG>
(Before anyone says "So use Leon's contrib builds!" - hey, I like to roll
my own with my own switches, what can I say.)

I can't get past this problem when trying to compile Firefox 1.5.0.2 on
Solaris 9 with Sun's Forte 6 Update 2 compiler suite:

nsInputStreamChannel.cpp
CC -o nsInputStreamChannel.o -c  -DMOZILLA_INTERNAL_API 
-DOSTYPE=\"SunOS5\" [...]
nsInputStreamChannel.cpp

"nsInputStreamChannel.cpp", line 395: Error: Could not find a match for 
NS_QueryNotificationCallbacks(nsCOMPtr<nsIInterfaceRequestor>, 
nsCOMPtr<nsILoadGroup>, nsCOMPtr<nsIProgressEventSink>).

1 Error(s) detected.
gmake[5]: *** [nsInputStreamChannel.o] Error 1
gmake[5]: Leaving directory 
`/usr/local/src/WWW/mozilla/1.8.0-Firefox/mozilla/netwerk/base/src'

The 3 parameters to NS_QueryNotificationCallbacks() are declared in

mozilla/netwerk/base/src/nsInputStreamChannel.h

class nsInputStreamChannel : public nsIInputStreamChannel
                           , public nsIStreamListener
{
[...]
protected:

    nsCOMPtr<nsIInputStreamPump>        mPump;
    nsCOMPtr<nsIInterfaceRequestor>     mCallbacks;
    nsCOMPtr<nsIProgressEventSink>      mProgressSink;
    nsCOMPtr<nsIURI>                    mOriginalURI;
    nsCOMPtr<nsIURI>                    mURI;
    nsCOMPtr<nsILoadGroup>              mLoadGroup;
    [...]

But the function is declared in

mozilla/netwerk/base/public/nsNetUtil.h

as:

/**
 * NS_QueryNotificationCallbacks implements the canonical algorithm for
 * querying interfaces from a channel's notification callbacks.  It first
 * searches the channel's notificationCallbacks attribute, and if the interface
 * is not found there, then it inspects the notificationCallbacks attribute of
 * the channel's loadGroup.
 */
inline void
NS_QueryNotificationCallbacks(nsIChannel   *aChannel,
                              const nsIID  &aIID,
                              void        **aResult)
{

So the header file defines the parameters one way
(nsCOMPtr<nsIInterfaceRequestor>, nsCOMPtr<nsIProgressEventSink>,
nsCOMPtr<nsILoadGroup>) whereas the function declaration wants them
another way (nsIChannel *, const nsIID, void **).

I can't imagine how Leon Sha's Solaris contrib builds get past this "error"
(interestingly, GCC 3.3.x compiles this file without complaint).  He's using
a more recent version of the Sun compiler suite, but still - a bug's a bug.

It gets even stranger.  In the directory

mozilla/netwerk/protocol/ftp/src

the file "nsFTPChannel.cpp" contains two calls to this same function,
but the second one supplies 4 arguments, not 3!

377:   NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup, progressSink);
541:   NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup, aIID, aResult);

How can the latter not be a bug as well - under *any* compiler?