Closed Bug 18639 Opened 25 years ago Closed 25 years ago

xpcom does not compile with Sun Workshop C++ 5.0 compiler

Categories

(Core :: XPCOM, defect, P3)

Sun
Solaris
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: akhil.arora, Assigned: dp)

Details

CC -library=iostream -o nsTraceRefcnt.o -c   -DMOZILLA_CLIENT -DBROKEN_QSORT=1
-DNSCAP_DISABLE_DEBUG_PTR_TYPES=1 -DMOZ_DEFAULT_TOOLKIT=\"gtk\" -DSTDC_HEADERS=1
-DHAVE_ST_BLKSIZE=1 -DHAVE_INT16_T=1 -DHAVE_INT32_T=1 -DHAVE_INT64_T=1
-DHAVE_UINT=1 -DHAVE_UINT_T=1 -DHAVE_UINT16_T=1 -DHAVE_SYS_BYTEORDER_H=1
-DHAVE_MEMORY_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_FILIO_H=1 -DHAVE_SYS_IPC_H=1
-DHAVE_SYS_SHM_H=1 -DHAVE_X11_EXTENSIONS_XSHM_H=1 -DHAVE_SYS_STATVFS_H=1
-DHAVE_SYS_STATFS_H=1 -DHAVE_SYS_VFS_H=1 -DHAVE_SYS_MOUNT_H=1 -DHAVE_LIBM=1
-DHAVE_LIBDL=1 -DHAVE_LIBRESOLV=1 -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1
-DHAVE_LIBELF=1 -DHAVE_LIBINTL=1 -DHAVE_LIBPOSIX4=1 -DHAVE_LIBW=1 -D_REENTRANT=1
-DHAVE_RANDOM=1 -DHAVE_QSORT=1 -DHAVE_STRERROR=1 -DHAVE_LCHOWN=1 -DHAVE_FCHMOD=1
-DHAVE_SNPRINTF=1 -DHAVE_LOCALTIME_R=1 -DHAVE_STATVFS=1 -DHAVE_MEMMOVE=1
-DHAVE_GETTIMEOFDAY=1 -DGETTIMEOFDAY_TWO_ARGS=1 -DHAVE_VALLOC=1
-DHAVE_IOS_BINARY=1 -DHAVE_OSTREAM=1 -DHAVE_CPP_EXPLICIT=1
-DHAVE_CPP_SPECIALIZATION=1 -DHAVE_CPP_USING=1 -DHAVE_CPP_NEW_CASTS=1
-DHAVE_I18N_LC_MESSAGES=1 -DMOZ_MAIL_NEWS=1 -DDEBUG=1 -DDEBUG_=1 -DTRACING=1
-DMOZ_USER_DIR=\".mozilla\" -DMOZ_DISABLE_DTD_DEBUG=1 -DMOZ_DLL_SUFFIX=\".so\"
-DXP_UNIX=1 -DUNIX_EMBED=1 -DX_PLUGINS=1 -DUNIX_LDAP=1 -DUNIX_ASYNC_DNS=1
-DJS_THREADSAFE=1 -DLAYERS=1  -mt -g  -KPIC  -DOSTYPE=\"SunOS5\" -DOJI
-D_IMPL_NS_COM  -I../../dist/include -I../../dist/include -I../../dist/include
-I../../include  -I../../dist/public/jpeg -I../../dist/public/png
-I../../dist/public/zlib  -I/usr/openwin/include  nsTraceRefcnt.cpp
"nsCOMPtr.h", line 584: Warning (Anachronism): Old explicit specialization
syntax.
"nsCOMPtr.h", line 841: Warning (Anachronism): Old explicit specialization
syntax.
"nsTraceRefcnt.cpp", line 381: Warning (Anachronism): Formal argument f of type
extern "C" int(*)(PLHashEntry*,int,void*) in call to
PL_HashTableEnumerateEntries(PLHashTable*, extern "C"
int(*)(PLHashEntry*,int,void*), void*) is being passed
int(*)(PLHashEntry*,int,void*).
"nsTraceRefcnt.cpp", line 384: Warning (Anachronism): Formal argument f of type
extern "C" int(*)(PLHashEntry*,int,void*) in call to
PL_HashTableEnumerateEntries(PLHashTable*, extern "C"
int(*)(PLHashEntry*,int,void*), void*) is being passed
int(*)(PLHashEntry*,int,void*).
"nsTraceRefcnt.cpp", line 388: Warning (Anachronism): Formal argument f of type
extern "C" int(*)(PLHashEntry*,int,void*) in call to
PL_HashTableEnumerateEntries(PLHashTable*, extern "C"
int(*)(PLHashEntry*,int,void*), void*) is being passed
int(*)(PLHashEntry*,int,void*).
"nsTraceRefcnt.cpp", line 404: Warning (Anachronism): Formal argument f of type
extern "C" int(*)(PLHashEntry*,int,void*) in call to
PL_HashTableEnumerateEntries(PLHashTable*, extern "C"
int(*)(PLHashEntry*,int,void*), void*) is being passed
int(*)(PLHashEntry*,int,void*).
"nsTraceRefcnt.cpp", line 423: Warning (Anachronism): Formal argument f of type
extern "C" int(*)(PLHashEntry*,int,void*) in call to
PL_HashTableEnumerateEntries(PLHashTable*, extern "C"
int(*)(PLHashEntry*,int,void*), void*) is being passed
int(*)(PLHashEntry*,int,void*).
"nsTraceRefcnt.cpp", line 531: Warning (Anachronism): Cannot cast from void* to
void(*)(void*,int,int).
"nsTraceRefcnt.cpp", line 532: Warning (Anachronism): Cannot cast from void* to
void(*)(void*,int,int).
"nsTraceRefcnt.cpp", line 557: Error: Cannot use const char* to initialize
char*.
"nsTraceRefcnt.cpp", line 571: Warning (Anachronism): Formal argument keyHash of
type extern "C" unsigned(*)(const void*) in call to PL_NewHashTable(unsigned,
extern "C" unsigned(*)(const void*), extern "C" int(*)(const void*,const void*),
extern "C" int(*)(const void*,const void*), const PLHashAllocOps*, void*) is
being passed unsigned(*)(const void*).
"nsTraceRefcnt.cpp", line 580: Warning (Anachronism): Formal argument keyHash of
type extern "C" unsigned(*)(const void*) in call to PL_NewHashTable(unsigned,
extern "C" unsigned(*)(const void*), extern "C" int(*)(const void*,const void*),
extern "C" int(*)(const void*,const void*), const PLHashAllocOps*, void*) is
being passed unsigned(*)(const void*).
"nsTraceRefcnt.cpp", line 595: Error: Cannot use const char* to initialize
char*.
2 Error(s) and 11 Warning(s) detected.
gmake[2]: *** [nsTraceRefcnt.o] Error 2
gmake[2]: Leaving directory `/opt/ws/mozilla/xpcom/base'
gmake[1]: *** [libs] Error 2
gmake[1]: Leaving directory `/opt/ws/mozilla/xpcom'
gmake: *** [libs] Error 2
Status: NEW → ASSIGNED
We dont use this compiler internally or say we support it. So unless you are
volunteering to fix this, I dont think we will actively work on fixing this
immediately.
Target Milestone: M20
Sure, I will volunteer to fix it. The following trivial cast fixes the problem.
Permission to check it in?

diff -r1.39 nsTraceRefcnt.cpp
557c557
<         char* cm = strchr(cp, ',');
---
>         char* cm = (char*) strchr(cp, ',');
595c595
<         char* cm = strchr(cp, ',');
---
>         char* cm = (char*) strchr(cp, ',');
Now the thing I dont understand is why is strchr() returning anything other than
a char *

I did man on a sunos 5.6 machine and see a char * strchr() definition.

Can you clarify ?
The 5.0 compiler tries to be very strictly ANSI/ISO compliant. Since most of the
system headers are not const-correct, it supplies its own versions. I have even
had to install some patches (107311-07, 107357-05, 107390-07) to get some system
headers patched. The compiler's copy of the header has this definition -

  const char* strchr( const char*, int );

in the file /opt/SUNWspro/SC5.0/include/CC/string_iso_SUNWCC.h, which is why the
conflict.
Thanks for the clarification akhil. Permissions to checkin granted. thanks.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.