Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53730 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23673 invoked from network); 3 Jul 2011 01:28:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2011 01:28:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:47007] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/42-29452-4B5CF0E4 for ; Sat, 02 Jul 2011 21:28:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 13DFE7000449 for ; Sun, 3 Jul 2011 02:28:17 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id QMcBhdfBDHsW for ; Sun, 3 Jul 2011 02:28:16 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp1.ist.utl.pt (Postfix) with ESMTP id CAC107000445 for ; Sun, 3 Jul 2011 02:28:16 +0100 (WEST) Received: from cataphract.cata.lo.geleia.net (cataphract.cata.lo.geleia.net [IPv6:2001:470:94a2:1:b488:8610:90e4:7835]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 59A232006626 for ; Sun, 3 Jul 2011 02:28:16 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net References: Date: Sun, 03 Jul 2011 02:27:16 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_IST?= Message-ID: In-Reply-To: User-Agent: Opera Mail/11.50 (Win32) Subject: Re: [PHP-DEV] Compilation warning on offsetof in 5.4 and trunk From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Sun, 03 Jul 2011 02:07:48 +0100, J=C3=A9r=C3=B4me Loyet wrote: > > the warnings appear in sapis (cgi, fpm, ...) and extensions (standard,= > ...) and the problem comes from the XOffsetOf macro which is expanded > to offsetof defined in Zend/zend_operators.h whit the following code > added in revisions 311662 and 312264: > > #ifndef offsetof > #define offsetof(t,f) \ > ((int)(&((t*)0)->f)) > #endif > Yes, the cast should be changed to (size_t)(uintptr_t). I have also hit this problem a month ago. At the time I think I commente= d = on IRC using (int)(intptr_t) instead could avoid problems like in "if = (offsetof(x) - 5 < 0)", but since the C standard calls for a =C2=ABexpan= d[ing] = to an integer constant expression that has type size_t=C2=BB, = (size_t)(uintptr_t) seems preferable. -- = Gustavo Lopes