From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Newsgroups: gmane.emacs.bugs,gmane.comp.lib.gnulib.bugs Subject: bug#9025: 24.0.50; gnulib defines intmax_t to int64_t on OSX, causes warnings and confusion. Date: Sat, 09 Jul 2011 13:18:50 +0200 Message-ID: <4E18391A.6070707@swipnet.se> References: <4E1826ED.9020602@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1310210379 10847 80.91.229.12 (9 Jul 2011 11:19:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jul 2011 11:19:39 +0000 (UTC) Cc: 9025@debbugs.gnu.org, bug-gnulib To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 09 13:19:34 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QfVZO-0007ND-7i for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jul 2011 13:19:34 +0200 Original-Received: from localhost ([::1]:52995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfVZN-0000jB-3D for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jul 2011 07:19:33 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfVZ2-0000if-M8 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 07:19:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfVYv-00017C-10 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 07:19:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfVYu-000171-6W for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 07:19:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QfVYt-0003mb-G9; Sat, 09 Jul 2011 07:19:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jul 2011 11:19:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9025 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9025-submit@debbugs.gnu.org id=B9025.131021034114534 (code B ref 9025); Sat, 09 Jul 2011 11:19:03 +0000 Original-Received: (at 9025) by debbugs.gnu.org; 9 Jul 2011 11:19:01 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfVYr-0003mN-AQ for submit@debbugs.gnu.org; Sat, 09 Jul 2011 07:19:01 -0400 Original-Received: from smtprelay-b22.telenor.se ([195.54.99.213]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfVYn-0003m8-J7 for 9025@debbugs.gnu.org; Sat, 09 Jul 2011 07:18:59 -0400 Original-Received: from ipb4.telenor.se (ipb4.telenor.se [195.54.127.167]) by smtprelay-b22.telenor.se (Postfix) with ESMTP id CBCF3EA5ED for <9025@debbugs.gnu.org>; Sat, 9 Jul 2011 13:18:51 +0200 (CEST) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap1IAFI4GE5V4S1kPGdsb2JhbABTEIQ0owwLAQEBAR4ZDSWIegKyLJAPgSuEAIEPBJdSgySHbjk X-IronPort-AV: E=Sophos;i="4.65,503,1304287200"; d="scan'208";a="1746715786" Original-Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb4.telenor.se with ESMTP; 09 Jul 2011 13:18:51 +0200 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 8074E7FA05A; Sat, 9 Jul 2011 13:18:50 +0200 (CEST) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <4E1826ED.9020602@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 09 Jul 2011 07:19:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:48322 gmane.comp.lib.gnulib.bugs:27474 Archived-At: Paul Eggert skrev 2011-07-09 12.01: > [Following up > and cc'ing to bug-gnulib:] > > Jan Dj=C3=A4rv writes: > >> Somewhere in gnulib, intmax_t gets defined to int64_t thus causing >> compiler warnings and general confusion (the code says intmax_t but is >> really int64_t). AFAIK, all versions of OSX have intmax_t. > > Thanks for reporting this. I assume that intmax_t is 'long long' > whereas int64_t is 'long'? If not, what are those two types defined > to in the system? and by gnulib? /usr/include/stdint.h: typedef long long int64_t; and #ifndef _INTMAX_T #define _INTMAX_T #ifdef __INTMAX_TYPE__ typedef __INTMAX_TYPE__ intmax_t; #else /* __INTMAX_TYPE__ */ typedef long long intmax_t; #endif /* __INTMAX_TYPE__ */ #endif /* _INTMAX_T */ I don't know where __INTMAX_TYPE__ is defined, but looking at preprocesse= d=20 output gives: typedef long int intmax_t; > > Which compiler and OS version are you using? % gcc -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5664~89/src/configure --disable-checkin= g=20 --enable-werror --prefix=3D/usr --mandir=3D/share/man=20 --enable-languages=3Dc,objc,c++,obj-c++=20 --program-transform-name=3D/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=3D/usr/= lib=20 --build=3Di686-apple-darwin10 --program-prefix=3Di686-apple-darwin10-=20 --host=3Dx86_64-apple-darwin10 --target=3Di686-apple-darwin10=20 --with-gxx-include-dir=3D/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5664) OSX 10.6.8. > > Does the following (untested) patch to lib/stdint.in.h fix your problem= ? Yes it does. Jan D. > > diff --git a/lib/stdint.in.h b/lib/stdint.in.h > index c44401f..0dd60b9 100644 > --- a/lib/stdint.in.h > +++ b/lib/stdint.in.h > @@ -270,6 +270,11 @@ typedef unsigned long int gl_uintptr_t; > /* Note: These types are compiler dependent. It may be unwise to use = them in > public header files. */ > > +/* If the system defines INTMAX_MAX, assume that intmax_t works, and > + similarly for UINTMAX_MAX and uintmax_t. This avoids problems with > + assuming one type where another is used by the system. */ > + > +#ifndef INTMAX_MAX > #undef intmax_t > #if @HAVE_LONG_LONG_INT@&& LONG_MAX>> 30 =3D=3D 1 > typedef long long int gl_intmax_t; > @@ -280,7 +285,9 @@ typedef long long int gl_intmax_t; > typedef long int gl_intmax_t; > # define intmax_t gl_intmax_t > #endif > +#endif > > +#ifndef UINTMAX_MAX > #undef uintmax_t > #if @HAVE_UNSIGNED_LONG_LONG_INT@&& ULONG_MAX>> 31 =3D=3D 1 > typedef unsigned long long int gl_uintmax_t; > @@ -291,6 +298,7 @@ typedef unsigned long long int gl_uintmax_t; > typedef unsigned long int gl_uintmax_t; > # define uintmax_t gl_uintmax_t > #endif > +#endif > > /* Verify that intmax_t and uintmax_t have the same size. Too much c= ode > breaks if this is not the case. If this check fails, the reason i= s likely > @@ -431,8 +439,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) =3D= =3D sizeof (uintmax_t) > > /* 7.18.2.5. Limits of greatest-width integer types */ > > +#ifndef INTMAX_MAX > #undef INTMAX_MIN > -#undef INTMAX_MAX > #ifdef INT64_MAX > # define INTMAX_MIN INT64_MIN > # define INTMAX_MAX INT64_MAX > @@ -440,13 +448,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t)= =3D=3D sizeof (uintmax_t) > # define INTMAX_MIN INT32_MIN > # define INTMAX_MAX INT32_MAX > #endif > +#endif > > -#undef UINTMAX_MAX > +#ifndef UINTMAX_MAX > #ifdef UINT64_MAX > # define UINTMAX_MAX UINT64_MAX > #else > # define UINTMAX_MAX UINT32_MAX > #endif > +#endif > > /* 7.18.3. Limits of other integer types */ >