From owner-freebsd-current@FreeBSD.ORG Sat Apr 17 07:17:55 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B88FF16A4CF for ; Sat, 17 Apr 2004 07:17:55 -0700 (PDT) Received: from gw.celabo.org (gw.celabo.org [208.42.49.153]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CC7F43D5A for ; Sat, 17 Apr 2004 07:17:55 -0700 (PDT) (envelope-from nectar@celabo.org) Received: from madman.celabo.org (madman.celabo.org [10.0.1.111]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "madman.celabo.org", Issuer "celabo.org CA" (not verified)) by gw.celabo.org (Postfix) with ESMTP id 061B65482B; Sat, 17 Apr 2004 09:17:55 -0500 (CDT) Received: by madman.celabo.org (Postfix, from userid 1001) id 9AE8A6D455; Sat, 17 Apr 2004 09:17:54 -0500 (CDT) Date: Sat, 17 Apr 2004 09:17:54 -0500 From: "Jacques A. Vidrine" To: Matthias Andree Message-ID: <20040417141754.GA94559@madman.celabo.org> Mail-Followup-To: "Jacques A. Vidrine" , Matthias Andree , Sam Varshavchik , courier-cone@lists.sourceforge.net, freebsd-current@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://www.celabo.org/ User-Agent: Mutt/1.5.6i cc: Sam Varshavchik cc: courier-cone@lists.sourceforge.net cc: freebsd-current@freebsd.org Subject: Re: GCC flaw in FreeBSD5? Cone 0.58 does not compile (was: [cone] Cone 0.58 released.) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Apr 2004 14:17:55 -0000 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::allocator >*, 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 / nectar@celabo.org / jvidrine@verio.net / nectar@freebsd.org