Closed Bug 501924 Opened 15 years ago Closed 14 years ago

AIX Compilation error for 3.6a1pre source mozilla/accessible/src/atk/nsAccessNodeWrap.cpp : "../../../dist/include/nsISupportsUtils.h", line 202.56: 1540-0062 (S) The incomplete class "nsAccessNode" must not be used as a qualifier

Categories

(Firefox :: Disability Access, defect)

PowerPC
AIX
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: shailen.n.jain, Unassigned)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11

While compiling mozilla/accessible/src/atk/nsAccessNodeWrap.cpp getting the below error -

"../../../dist/include/nsISupportsUtils.h", line 202.56: 1540-0062 (S) The incomplete class "nsAccessNode" must not be used as a qualifier.
"../../../dist/include/nsISupportsUtils.h", line 197.1: 1540-0700 (I) The previous message was produced while processing "CallQueryInterface<nsIAccessible,nsAccessNode>(nsIAccessible *, nsAccessNode **)".
"/home/guest/sb/mercurial/mozilla/accessible/src/atk/../base/nsAccUtils.h", line 295.7: 1540-0700 (I) The previous message was produced while processing "nsAccUtils::QueryAccessNode(nsIAccessible *)".
"../../../dist/include/nsISupportsUtils.h", line 202.56: 1540-0062 (S) The incomplete class "nsAccessNode" must not be used as a qualifier.
"../../../dist/include/nsISupportsUtils.h", line 197.1: 1540-0700 (I) The previous message was produced while processing "CallQueryInterface<nsIAccessNode,nsAccessNode>(nsIAccessNode *, nsAccessNode **)".
"/home/guest/sb/mercurial/mozilla/accessible/src/atk/../base/nsAccUtils.h", line 308.7: 1540-0700 (I) The previous message was produced while processing "nsAccUtils::QueryAccessNode(nsIAccessNode *)".
"../../../dist/include/nsISupportsUtils.h", line 202.56: 1540-0062 (S) The incomplete class "nsAccessNode" must not be used as a qualifier.
"../../../dist/include/nsISupportsUtils.h", line 197.1: 1540-0700 (I) The previous message was produced while processing "CallQueryInterface<nsIAccessibleDocument,nsAccessNode>(nsIAccessibleDocument *, nsAccessNode **)".
"/home/guest/sb/mercurial/mozilla/accessible/src/atk/../base/nsAccUtils.h", line 321.7: 1540-0700 (I) The previous message was produced while processing "nsAccUtils::QueryAccessNode(nsIAccessibleDocument *)".
gmake[1]: *** [nsAccessNodeWrap.o] Error 1

Reproducible: Always

Steps to Reproduce:
1. Build Mozilla Firefox 3.6a1pre build on AIX with Gnome RPMS of 64 bit
version.
2.
3.
Actual Results:  
Build fails with the above error.


Expected Results:  
No build failure
OS: Other → AIX
Version: unspecified → Trunk
Attached patch Patch V 1Splinter Review
Submitting the patch to resolve the error.
Attachment #386486 - Flags: review?(benjamin)
Comment on attachment 386486 [details] [diff] [review]
Patch V 1

This code is silly to begin with: you should be able to use a single template to do all this:

template<class Dest>
inline already_AddRefed<Dest>
QueryAccessNode(nsISupports* aSomething)
{
  Dest* d = nsnull;
  if (aSomething)
    CallQueryInterface(aSomething, &d);

  return d;
}
Attachment #386486 - Flags: review?(benjamin) → review-
I got no warning for nsAccessNodeWrap.cpp on Solaris with Sun Studio.

You should not move them to .cpp, they should be inlined.
most easy workaround for AIX platform: 
echo "ac_add_options --disable-accessibility" >> .mozconfig
This unit does not compile on AIX with VisualAge 6, XLC/C++ 7 or XLC/C++ 8, even with the lasted compiler fix packs.

Moving the implementation to .cpp make them compile, but result in unresolved externals later when linkitup libxul.so.

disabling accessibility for AIX is only a temporary workaround.
Surkov,

I just noticed you have moved QueryAccess* from nsAccUtils.h to nsAccUtils.cpp.
I'm afraid it's not something we want to do.

Can we just use something like QueryObject and get rid of all QueryAccess*?

Note: This comment does not belong to this bug. I put it here, because it was suggested in comment #2.
(In reply to comment #7)
> Surkov,
> 
> I just noticed you have moved QueryAccess* from nsAccUtils.h to nsAccUtils.cpp.
> I'm afraid it's not something we want to do.
> 
> Can we just use something like QueryObject and get rid of all QueryAccess*?

I think yes.
(In reply to comment #2)
> (From update of attachment 386486 [details] [diff] [review])
> This code is silly to begin with: you should be able to use a single template
> to do all this:
> 
> template<class Dest>
> inline already_AddRefed<Dest>
> QueryAccessNode(nsISupports* aSomething)
> {
>   Dest* d = nsnull;
>   if (aSomething)
>     CallQueryInterface(aSomething, &d);
> 
>   return d;
> }

Before I can rework /create a patch according to your comment I need to understand where problem is sourced exactly.

this is what I think I have found so far:

The compiler's error message is that an only forward declared class can not be used as template parameter which is dereferenced within the template function.
When I try to change replacing the forward with an "#include "nsAccessNode.h"
the error message changes, but still pointing towards:

In  CallQueryInterface a method nsAccessNode::QueryInterface is called, which is not in the scope of the current translation unit "nsAccUtils.h" nor "nsAccesNodeWrap.cpp".

I cannot see the implementation in nsAccessNode, but the macro 
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS implements QueryInterface within a nested class generated into nsAccessNode.cpp.

If the compiler complains about incomplete class and the class does not implement a QueryInterface the class is incomplete, as it is declared pure virtual in it's base. Since I cannot believe other compilers would compile code as described here, I guess there is something I missed and this is hard stuff to understand even without the macros.
Seems the QueryInterface is expanded and implemented by the macro NS_DECL_ISUPPORTS.
Same issue seen while compiling on HPUX too. Could you fix this ?
(In reply to comment #11)
> Same issue seen while compiling on HPUX too. Could you fix this ?

Have you tried GCC or aCC?  PA-Risc or ia64?

I wasn't able to fix this.

My guess is the problem is located in "xpcom/base/nscore.h" about line 115 to 124. Or at least I haven't found the macro hell going deeper than that ;-)
The empty macros don't do the job and there is not such equivalent compiler directive for the IBM compiler. 
The source relies on non-standard features commonly available on targets using the ELF binary format which works fine for MaxOSX, Linux, BSD, Solaris. 

AIX is XCOFF, there is no such thing as __attribute__((hidden)). 
The visibility is chosen on what the ANSI standard demands for the current scope. It can be overriden at link time, but then I need the mangled name, which isn't available at compile time.

Fixing this in an strictly ANSI conforming way needs an understanding of the whole code I don't have.

So see https://bugzilla.mozilla.org/show_bug.cgi?id=501924#c5 :-(
This is on ia64. Moving the implemetation to cpp file solved the problem. Now I am stuck with new aCC issue :

"nsNavHistory.cpp", line 4535: error #2312: no suitable user-defined conversion from "nsMaybeWeakPtr<n
sINavHistoryObserver>" to "const nsCOMPtr<nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS>" exists
    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
    ^
....

1 error detected in the compilation of "nsNavHistory.cpp".
gmake[1]: *** [nsNavHistory.o] Error 2
(In reply to comment #13)
> This is on ia64. Moving the implemetation to cpp file solved the problem.

On AIX this only solves the compilation error: 
later when linking libxul.so I got unresolved external symbols, which point back to this unit with implementation moved to cpp.
We worked around this:
"nsNavHistory.cpp", line 4535: error #2312: no suitable user-defined conversion
from "nsMaybeWeakPtr<n
sINavHistoryObserver>" to "const
nsCOMPtr<nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS>" exists
    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
    ^

With the attached patch.
Thankyou . This fix solved the problem.

(In reply to comment #15)
> Created an attachment (id=430673) [details]
> hack to work around issue with aCC
> We worked around this:
> "nsNavHistory.cpp", line 4535: error #2312: no suitable user-defined conversion
> from "nsMaybeWeakPtr<n
> sINavHistoryObserver>" to "const
> nsCOMPtr<nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS>" exists
>     ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
>     ^
> With the attached patch.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: major → normal
Component: General → Disability Access
QA Contact: general → disability.access
Hardware: Other → PowerPC
firefox crashes , when I try to  run about:config. Has anyone see this issue before ?


Program received signal SIGSEGV, Segmentation fault
  si_code: 1 - SEGV_MAPERR - Address not mapped to object.
nsCOMPtr_base::assign_with_AddRef () at ./../glue/nsCOMPtr.h:457
457                 NSCAP_RELEASE(this, oldPtr);
(gdb) bt
#0  nsCOMPtr_base::assign_with_AddRef () at ./../glue/nsCOMPtr.h:457
#1  0x2000000077a19960:0 in nsTreeBodyFrame::GetScrollParts ()
    at nsTreeBodyFrame.cpp:921
#2  0x2000000077a45780:0 in nsTreeBodyFrame::SetBounds ()
    at nsTreeBodyFrame.cpp:442
#3  0x200000007755ada0:0 in nsSprocketLayout::Layout ()
    at nsSprocketLayout.cpp:489
#4  0x200000007750dab0:0 in nsBoxFrame::DoLayout () at nsBoxFrame.cpp:940
#5  0x200000007750abc0:0 in nsIFrame::Layout () at nsBox.cpp:561
#6  0x200000007755b4f0:0 in nsSprocketLayout::Layout ()
    at nsSprocketLayout.cpp:523
#7  0x200000007750dab0:0 in nsBoxFrame::DoLayout () at nsBoxFrame.cpp:940
#8  0x200000007750abc0:0 in nsIFrame::Layout () at nsBox.cpp:561
#9  0x2000000077562760:0 in nsStackLayout::Layout () at nsStackLayout.cpp:295
#10 0x200000007750dab0:0 in nsBoxFrame::DoLayout () at nsBoxFrame.cpp:940
#11 0x200000007750abc0:0 in nsIFrame::Layout () at nsBox.cpp:561
#12 0x200000007755b4f0:0 in nsSprocketLayout::Layout ()
    at nsSprocketLayout.cpp:523
#13 0x200000007750dab0:0 in nsBoxFrame::DoLayout () at nsBoxFrame.cpp:940
#14 0x200000007750abc0:0 in nsIFrame::Layout () at nsBox.cpp:561
#15 0x200000007750a740:0 in nsBoxFrame::Reflow () at nsBoxFrame.cpp:751
#16 0x2000000077594f80:0 in nsLineLayout::ReflowFrame ()
#17 0x20000000775bc990:0 in nsBlockFrame::ReflowInlineFrame ()
    at nsBlockFrame.cpp:3614
#18 0x20000000775af650:0 in nsBlockFrame::DoReflowInlineFrames ()
    at nsBlockFrame.cpp:3435
#19 0x20000000775ae5b0:0 in nsBlockFrame::ReflowLine ()
    at nsBlockFrame.cpp:3281
#20 0x20000000775ac150:0 in nsBlockFrame::ReflowDirtyLines ()
    at nsBlockFrame.cpp:1911
#21 0x20000000775a5a70:0 in nsBlockFrame::Reflow () at nsBlockFrame.cpp:955
#22 0x200000007759c110:0 in nsBlockReflowContext::ReflowBlock ()
    at nsBlockReflowContext.cpp:310
#23 0x20000000775bfa40:0 in nsBlockFrame::ReflowBlockFrame ()
    at nsBlockFrame.cpp:3009
#24 0x20000000775ae830:0 in nsBlockFrame::ReflowLine ()
    at nsBlockFrame.cpp:2283
#25 0x20000000775ac150:0 in nsBlockFrame::ReflowDirtyLines ()
    at nsBlockFrame.cpp:1911
#26 0x20000000775a5a70:0 in nsBlockFrame::Reflow () at nsBlockFrame.cpp:955
#27 0x200000007759c110:0 in nsBlockReflowContext::ReflowBlock ()
    at nsBlockReflowContext.cpp:310
#28 0x20000000775bfa40:0 in nsBlockFrame::ReflowBlockFrame ()
    at nsBlockFrame.cpp:3009
#29 0x20000000775ae830:0 in nsBlockFrame::ReflowLine ()
    at nsBlockFrame.cpp:2283
.....
fixed by bug 561734
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
(In reply to comment #18)
> fixed by bug 561734

Not fixed on branch mozilla-1.9.2
Status update for AIX:
but: when compiling with IBM XLC/C++ 9.0 no error, when using IBM XLC/C++ 8 (which is the latest version supporting AIX 5.1) the only workaround is still
--disable-accessibility
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: