From owner-freebsd-standards@FreeBSD.ORG Thu Jan 26 16:56:17 2012 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B931106564A; Thu, 26 Jan 2012 16:56:17 +0000 (UTC) (envelope-from theraven@freebsd.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id E48668FC0C; Thu, 26 Jan 2012 16:56:16 +0000 (UTC) Received: from [192.168.0.2] (cpc1-cwma8-2-0-cust257.7-3.cable.virginmedia.com [82.20.153.2]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id q0QGu72J060492 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 26 Jan 2012 16:56:08 GMT (envelope-from theraven@freebsd.org) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20120126140021.GA18060@zim.MIT.EDU> Date: Thu, 26 Jan 2012 16:56:02 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <4BC83792-2FE3-4B7A-8CB1-18B4FF82A8CD@freebsd.org> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> <20120126140021.GA18060@zim.MIT.EDU> To: David Schultz X-Mailer: Apple Mail (2.1251.1) Cc: freebsd-standards@freebsd.org, python@freebsd.org, Andriy Gapon , gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 16:56:17 -0000 On 26 Jan 2012, at 14:00, David Schultz wrote: > On Thu, Jan 26, 2012, David Chisnall wrote: >>=20 >> On 26 Jan 2012, at 04:47, Eitan Adler wrote: >>> What about patching python to only define the POSIX macros iff glibc >>> is being used (and getting this upstreamed) ? >=20 > That's a good strategy regardless. As long as python is doing > something bogus, it could easily break in the future. >=20 >> Index: include/xlocale.h > [...] >> +/* >> + * If people turned off POSIX2008 stuff, but still explicitly = included the >> + * xlocale.h header, then assume that they actually do want these = functions and >> + * define them. >> + */ >> +#ifndef __X_LOCALE_DEFINED >> +#define __X_LOCALE_DEFINED >>=20 >> +#define LC_COLLATE_MASK (1<<0) >> +#define LC_CTYPE_MASK (1<<1) >> +#define LC_MESSAGES_MASK (1<<2) >> +#define LC_MONETARY_MASK (1<<3) >> +#define LC_NUMERIC_MASK (1<<4) >> +#define LC_TIME_MASK (1<<5) >> +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | = LC_MESSAGES_MASK | \ >> + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) >> +#define LC_GLOBAL_LOCALE ((locale_t)-1) >> + >> +typedef struct _xlocale *locale_t; >> +locale_t newlocale(int mask, const char *locale, locale_t base); >> +locale_t duplocale(locale_t base); >> +int freelocale(locale_t loc); >> +const char *querylocale(int mask, locale_t loc); >> +locale_t uselocale(locale_t loc); >> + >> +#endif /* __X_LOCALE_DEFINED */ >=20 > It would be preferable not to have two copies of all the > definitions and declarations in the source. This is often handled > with separate headers like sys/_timeval.h and sys/_types.h. > Perhaps that's too many hoops to jump through just to cope with > buggy applications. (Incidentally, I noticed that the LC_* macros > are in a slightly different order from the LC_*_MASK macros. For > that reason, and only that reason, it's not possible to define the > latter in terms of the former.) >=20 > Would it suffice, perhaps, to simply change the xlocale > declarations to use type `struct _xlocale' instead of locale_t? > That won't fix apps that expect the LC_*_MASK macros to be > defined, but it looks like it will at least make the header > compile in a strict POSIX environment, and it avoids the=20 > duplication. Yup, that would probably be fine. > By the way, struct _xlocale needs another underscore in front of > it. Names prefixed with a single underscore and a lowercase > letter are in the application's namespace. It is struct _xlocale on Darwin, where this API was introduced as an = extension before making it into POSIX, so I kept the name in case anyone = depends on this. David=