[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Small patch for groff 1.18 on Solaris 8 using the SUN Forte compiler
From: |
Petter Reinholdtsen |
Subject: |
Small patch for groff 1.18 on Solaris 8 using the SUN Forte compiler |
Date: |
Thu, 25 Jul 2002 13:47:52 +0200 |
GROFF VERSION:
1.18
MACHINE:
Sun UltraSPARC
OS:
SunOS 5.8
COMPILER:
SUN Forte C and C++ compiler
INPUT FILES:
Not needed.
COMMAND LINE:
Not needed.
DESCRIPTION OF INCORRECT BEHAVIOUR:
The source fail to compile on Solaris 8 using the SUN Forte
compiler. This is the compile output.
CC-wrapper
-I. -I/usit/saruman/store/groff/src-1.18-sun4os58/src/libs/libdriver
-I/usit/saruman/store/groff/src-1.18-sun4os58/src/include
-I/usit/saruman/store/groff/src-1.18-sun4os58/src/include
-DHAVE_CONFIG_H -g -c input.cc
"input.cc", line 915: Error: Overloading ambiguity between
"Char::operator int() const" and "Char::operator unsigned char()
const".
"input.cc", line 915: Error: Overloading ambiguity between
"Char::operator int() const" and "Char::operator unsigned char()
const".
"input.cc", line 934: Error: Overloading ambiguity between
"Char::operator int() const" and "Char::operator unsigned char()
const".
"input.cc", line 934: Error: Overloading ambiguity between
"Char::operator int() const" and "Char::operator unsigned char()
const".
"input.cc", line 1045: Warning: String literal converted to char* in
assignment.4 Error(s) and 1 Warning(s) detected.
I tracked the problem down to the use of 'const' in the lines. The
'operator==' can not operate on const objects, so the compiler tries
to work around it using implicit casts. There is also no
'operator!=', so the compiler tries implicit casts without getting a
obvious solution. Thus the error messages.
SUGGESTED FIX [optional]:
The following patch fixes the problem, and make sure the compiler uses
the class operatoris instead of implicit casts.
diff -ur src-1.18/src/libs/libdriver/input.cc
src-1.18-sun4os58/src/libs/libdriver/input.cc
--- src-1.18/src/libs/libdriver/input.cc Sun Apr 14 12:22:57 2002
+++ src-1.18-sun4os58/src/libs/libdriver/input.cc Thu Jul 25 13:37:28
2002@@ -297,8 +297,10 @@
public:
Char(void) : data('\0') {}
Char(const int c) : data(c) {}
- bool operator==(int c) { return (data == c) ? true : false; }
- bool operator==(Char c) { return (data == c.data) ? true : false; }
+ bool operator==(int c) const { return (data == c) ? true : false; }
+ bool operator==(const Char c) const { return (data == c.data) ? true :
false; }
+ bool operator!=(int c) const { return ! (*this == c); }
+ bool operator!=(const Char c) const { return ! (*this == c); }
operator int() const { return (int) data; }
operator unsigned char() const { return (unsigned char) data; }
operator char() const { return (char) data; }
@@ -929,7 +931,7 @@
inline bool
is_space_or_tab(const Char c)
{
- return (c == (Char) ' ' || c == (Char) '\t') ? true : false;
+ return (c == Char(' ') || c == Char('\t')) ? true : false;
}
//////////////////////////////////////////////////////////////////////
- Small patch for groff 1.18 on Solaris 8 using the SUN Forte compiler,
Petter Reinholdtsen <=