Closed Bug 39424 Opened 24 years ago Closed 24 years ago

SUNWspro5.0 bustage with new string APIs

Categories

(Core :: XPCOM, defect, P1)

Sun
Solaris
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: waterson)

References

Details

Attachments

(2 files)

SUNWspro5.0 (native Sun compiler) is having problems with the new string APIs.
One of the problems is easily fixed:

Index: nsCharTraits.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/ds/nsCharTraits.h,v
retrieving revision 1.8
diff -u -r1.8 nsCharTraits.h
--- nsCharTraits.h      2000/05/13 20:17:35     1.8
+++ nsCharTraits.h      2000/05/16 17:28:51
@@ -307,7 +307,7 @@
     const char*
     find( const char* s, size_t n, char c )
       {
-        return NS_STATIC_CAST(char*, memchr(s, to_int_type(c), n));
+        return NS_STATIC_CAST(const char*, memchr(s, to_int_type(c), n));
       }
 
 #if 0

There is another one that it's tripping over in
netwerk/mime/src/nsXMLMIMEDataSource.cpp that seems a bit
more serious:

"../../../dist/include/nsAReadableString.h", line 1172: Error: Cannot cast from
basic_nsLiteralString<char> to const basic_nsAReadableString<char>&.
"../../../dist/include/nsString.h", line 800:     Where: While instantiating
"Compare<char>(const basic_nsAReadableString<char>&, const char*)".
"../../../dist/include/nsString.h", line 800:     Where: Instantiated from
non-template code.
1 Error(s) detected.
The first change looks like a no-brainer. As for the second, IIRC, we only 
needed this to resolve ambiguity on gcc-2.7.2.3 (but don't quote me on that: 
we'll need to run it through the gauntlet on Win32, egcs-1.1.2, and MetroWerks). 
We may be able to write an autoconf test that determines whether or not the 
ambiguity-resolving cast is required.
Let me clarify. We should be able to do something like:

#ifdef NEED_CPP_AMBIGUITY_RESOLVED_FOR_TEMPLATES /* XXX or something */
#define NS_READABLE_CAST(expr) NS_STATIC_CAST(/* that big-ass mess */)
#else
#define NS_READABLE_CAST(expr) expr
#endif
Yeah, the first fix is a no-brainer.  I should have written it that way in the 
first place.  The fixed version is correct; the previous version has a |const| 
error.  I will check that in soon.  As for the second case, yes ... waterson and 
I have wrestled with this particular problem on different platforms for a while 
now.  We can do the right thing ... it just turns out to be different on every 
platform.
Status: NEW → ASSIGNED
Target Milestone: --- → M16
Target Milestone: M16 → M17
Target Milestone: M17 → M16
*** Bug 39730 has been marked as a duplicate of this bug. ***
The fix for the first case is checked in.  Now we just have to figure out what to 
do about the second case.
[richb - 5/24/00]
Scott/Chris,

If you could isolate the second case out into a small self-contained C++
program that reproduces/replicates the problem with the Sun compilers, I'll
file a P1/S1 bug against the compilers and get them to look at it right away.
Thanks.
[richb - 5/25/00]
I've filed a P1/S1 bug against the Sun compilers on this (4341384). It
also fails with Workshop 6 (ie. v5.1 of the Sun compilers).

I've received some comments from the Sun compiler guy who's been looking
at this:

"The code looks OK to me. I think it's a compiler bug, but I
can't reproduce it with a simple test case. The cast in the
failing expression isn't needed, and if you remove it, the
code compiles.

That is, the line in question expands to this:

return Compare ( lhs ,
    ( static_cast < const basic_nsAReadableString < CharT > & >
        ( ( basic_nsLiteralString < CharT > ( rhs ) ) ) ) ) ;

If you remove the static_cast, the code compiles:

return Compare ( lhs ,
        ( ( basic_nsLiteralString < CharT > ( rhs ) ) ) ) ;

I think the corresonding source code change would be changing this
    return Compare(lhs, NS_READABLE_CAST(CharT, 
	basic_nsLiteralString<CharT>(rhs)));

to this
    return Compare(lhs,  
	basic_nsLiteralString<CharT>(rhs));
"

Scott, is this an acceptable change, and would it work across all platforms?
[richb - 5/26/00]
I've changed the priority and severity of this bug to P1/critical.
This problem is preventing the Solaris build of Mozilla from compiling
when we use the Sun native compilers.

There is a proposed fix. Can this be reviewed/approved and  checked
in please?
Severity: normal → critical
Priority: P3 → P1
Since scc is on vacation, I'll take a look at this.
Assignee: scc → waterson
Status: ASSIGNED → NEW
When we started, we weren't using a cast here at all.  It turned out to be 
required by some of the broken compilers to avoid `type-unification' errors.  We 
struggled to make the cast something palatable to all compilers.  It may be that 
we need to conditionally define it, e.g., to nothing, on platforms where it turns 
out to be problematic.

Shouldn't be too hard, _if_ we can write an autoconf test for it :-)
richb, tor: could you try the attached patch and let me know if it does the job?
Works on gcc-2.7.2.3 and Linux.
Status: NEW → ASSIGNED
Tested with SUNWspro5.0; it does the right thing.
[richb - 5/26/00]
I second tor's findings. I downloaded last night's .tar.gz, and have just
finished building it with your patch with SC5.0 on a Solaris 7 (SPARC) machine.
It runs fine. Thankyou!
I like it too!
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
This patch breaks FreeBSD 3.4 with gcc version 2.7.2.3. See next attachment. If
I check out r1.55 of nsAReadableString.h it compiles.
Attached file Build log
Sent mail to Joerg to verify that "configure" was re-run.
Ok, just re-run configure, pulled the latest nsAReadableString.h version, 
and it compiles just fine. Sorry for causing confusion.
I'm still having problems getting a compile working with WS5.0 with the latest
tip.
Configure options: --enable-nspr-autoconf --enable-mathml --enable-svg
--with-extensions
Configure env args: CC=cc CXX=CC

CC -library=iostream  -mt  -DDEBUG -DDEBUG_cls -DTRACING -g -o regExport
regExport.o -xildoff -L../../../dist/bin -L../../../dist/lib  -L/space/ws50/lib
-L/usr/openwin/lib -R/usr/openwin/lib -lgtk -lgdk -lgmodule -lglib -ldl -lXext
-lX11 -lsocket -lnsl -lm -L../../../dist/bin -lplds4 -lplc4 -lnspr4 -lpthread
-L../../../dist/bin -lxpcom  -lw -lposix4 -lintl -lelf -lnsl -lsocket -lresolv
-liostream -lCrun -ldl -lm   
Undefined                       first referenced
 symbol                             in file
void basic_nsAWritableString<unsigned short>::do_AppendFromElement(unsigned
short) ../../../dist/bin/libxpcom.so
void basic_nsAWritableString<char>::do_AppendFromElement(char)
../../../dist/bin/libxpcom.so
ld: fatal: Symbol referencing errors. No output written to regExport

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Looks like WS5.0 has a little problem with template inlined virtual members.  Can 

you chop out the |inline| specification on |do_AppendFromElement| (at or around

<http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsAWritableString.h#563>).  Let 

me know if that fixes the problem, and I'll decide if I can live without it 

(probably) or if I need an auto-conf test.

Oops.  My mistake.  After applying the OS patches listed at
http://www.mozilla.org/unix/solaris.html , the problem went away.
Status: REOPENED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
QA Contact: leger → hong
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: