Re: GCC flaw in FreeBSD5? Cone 0.58 does not compile (was: Cone 0.58 released.)
"Jacques A. Vidrine" <[email protected]>
| Newsgroups | gmane.mail.cone |
|---|---|
| Message-ID | <20040417141754.GA94559__26238.2289315157$1082221704@madman.celabo.org> |
On Fri, Apr 16, 2004 at 05:30:13PM +0200, Matthias Andree wrote:
> 0.58 - without any patches - does not compile on FreeBSD 5-CURRENT:
>
> gmake[2]: Entering directory `/tmp/root/ports/mail/cone/work/cone-0.58/libmail'
> gmake all-am
> gmake[3]: Entering directory `/tmp/root/ports/mail/cone/work/cone-0.58/libmail'
> Compiling mbox.C
> mbox.C: In member function `bool mail::mbox::scan(mail::file&, mail::file*,
> bool, std::set<std::string, std::less<std::string>,
> std::allocator<std::string> >*, bool, mail::callback*)':
> mbox.C:1246: error: base operand of `->' has non-pointer type `mail::file'
> mbox.C:1283: error: base operand of `->' has non-pointer type `mail::file'
> gmake[3]: *** [mbox.o] Error 1
> gmake[3]: Leaving directory `/tmp/root/ports/mail/cone/work/cone-0.58/libmail'
> gmake[2]: *** [all] Error 2
>
> The code looks fine and compiles fine on SuSE Linux 8.2 with an updated
> vanilla GCC 3.3.3. Given that mail::file has an operator FILE *() that
> returns the FILE* pointer, I don't see what the compiler wants to tell
> me. Cc:'ing FreeBSD-current.
>
> > 1149 bool mail::mbox::scan(mail::file &scanFile,
> > 1150 mail::file *saveFile,
> ...
> 1243 // Remember how big the saveFile was,
> 1244 // originally.
> 1245
> > 1246 if (fstat(fileno(*saveFile), &stat_buf) < 0)
> 1247 {
> 1248 return false;
> 1249 }
> 1250
> ...
> 1280 {
> 1281 // Potential short cut.
> 1282
> > 1283 if (fstat(fileno(scanFile), &stat_buf) < 0)
> 1284 {
> 1285 return false;
> 1286 }
> 1287
>
>
> -bash-2.05b# gmake --version
> GNU Make 3.80
>
> -bash-2.05b# gcc --version (g++ is the same version, I checked)
> gcc (GCC) 3.3.3 [FreeBSD] 20031106
>
> Config.log is attached.
`fileno' may be implemented as a macro (as it is on FreeBSD), so one
cannot rely on implicit conversions. The invocations MUST be
fileno((FILE *)(*saveFile))
Or better yet, the implicit conversions should be removed and replaced
by an explicit operation, e.g. `fileno(saveFile->fp())'. See the
rationale for the std::string c_str() function for more reasons why
implicit conversions are dangerous and should be avoided.
Cheers,
--
Jacques Vidrine / [email protected] / [email protected] / [email protected]
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Courier-cone mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-cone