Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15633 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99021 invoked by uid 1010); 27 Mar 2005 11:51:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99006 invoked from network); 27 Mar 2005 11:51:27 -0000 Received: from unknown (HELO auna.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2005 11:51:27 -0000 X-Host-Fingerprint: 62.245.70.224 r2g224.chello.upc.cz FreeBSD 4.6-4.9 Received: from ([62.245.70.224:3424] helo=isis.sigpipe.cz) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id 40/F4-08304-F3E96424 for ; Sun, 27 Mar 2005 06:51:27 -0500 Received: by isis.sigpipe.cz (Postfix, from userid 1001) id 76C271F87BEE; Sun, 27 Mar 2005 13:51:24 +0200 (CEST) Date: Sun, 27 Mar 2005 13:51:24 +0200 To: Derick Rethans Cc: internals@lists.php.net Message-ID: <20050327115124.GA14257@isis.sigpipe.cz> References: <20050326235844.GA6613@isis.sigpipe.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i Subject: Re: [PHP-DEV] snprintf / ap_php_snprintf, %lld, gcc versions? From: neuhauser@sigpipe.cz (Roman Neuhauser) # derick@php.net / 2005-03-27 07:49:31 +0200: > On Sun, 27 Mar 2005, Roman Neuhauser wrote: > > I'm having a puzzling problem with %lld conversion handling > > in ap_php_snprintf, and it seems to be gcc version-dependent. > > > > I found this problem through Statgrab, which has this macro: > > > > #define PHP_SG_ADD_LLVAL(rtz, key, val) { \ > > char tmp[256]; \ > > int tmp_len = snprintf((char *)&tmp, sizeof(tmp) - 1, "%lld", val); \ > > add_assoc_stringl_ex(rtz, key, sizeof(key), tmp, tmp_len, 1); \ > > } > > > > main/snprintf.[hc]: > > > > #define snprintf ap_php_snprintf > > PHPAPI int ap_php_snprintf(char *buf, size_t len, const char *format,...) > > For some reason the header file is not included then That doesn't seem to be the case. The library is built with cc -I. -I/usr/ports/sysutils/pecl-statgrab/work/Statgrab-0.3 -DPHP_ATOM_INC -I/usr/ports/sysutils/pecl-statgrab/work/Statgrab-0.3/include -I/usr/ports/sysutils/pecl-statgrab/work/Statgrab-0.3/main -I/usr/ports/sysutils/pecl-statgrab/work/Statgrab-0.3 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -DHAVE_CONFIG_H -O -pipe -prefer-pic -c /usr/ports/sysutils/pecl-statgrab/work/Statgrab-0.3/statgrab.c -o statgrab.o >/dev/null 2>&1 and when I replace "-o statgrab.o >/dev/null 2>&1" with "-E" I see: # 65 "/usr/local/include/php/main/snprintf.h" int ap_php_snprintf(char *, size_t, const char *, ...) __attribute__ ((format(printf, 3, 4))); and the macro calls expanded to use ap_php_snprintf(). Plus, this program works on the machines where the Statgrab extension produces "%ld": #include int main (int argc, char **argv) { char tmp[256]; int tmp_len = snprintf((char *)&tmp, sizeof(tmp) - 1, "%lld", 127LL); printf("strlen (%s) == %d\n", tmp, tmp_len); return 0; } -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991