pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Petr Jelinek <petr@2ndquadrant.com>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: VS 2015 support in src/tools/msvc
Date: Tue, 8 Mar 2016 23:31:37 -0500
Message-ID: <20160309043137.GA933917@tornado.leadboat.com> (raw)
In-Reply-To: <CAB7nPqRSsrn5etFDEJ+VrWcoxFee8WRBteSgwobKocKQJUFC_A@mail.gmail.com>
References: <CAB7nPqRL+kuZ8dq6P3WXv-b0-0LAwTxecnaLnvBn4ah7PSbWsQ@mail.gmail.com>
	<CAB7nPqT8mfN6GoRt4WcNh8WiK==sSh3VkVonRFMzOi6oXefTQw@mail.gmail.com>
	<56DA6394.9040404@2ndquadrant.com>
	<CAB7nPqQfoNWGnXjTCf8ZuRtcz0D0fHpE43haoy3CHYgJVf1oDg@mail.gmail.com>
	<15559.1457156815@sss.pgh.pa.us>
	<56DAEE74.3010604@dunslane.net>
	<CAB7nPqSuzGoZPvCUhbDFTkmsD9z6oLAaHeB-yc7_Qb4sh_f-fg@mail.gmail.com>
	<56DB47A5.7040502@dunslane.net>
	<CAB7nPqSOL9vLmaecT+SDhkFTOje8erdnvC-KT+dH9_bBQsV5zg@mail.gmail.com>
	<CAB7nPqRSsrn5etFDEJ+VrWcoxFee8WRBteSgwobKocKQJUFC_A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Tue, Mar 08, 2016 at 10:32:28PM +0900, Michael Paquier wrote:
> Subject: [PATCH 3/4] Fix use of locales for VS 2015
> 
> lc_codepage is a flag missing from locale.h, causing this code path
> introduced in VS 2012 to fail. Perhaps there is a reason for this field
> to have been clobbered, but let's fall back to the pre-VS-2012 code
> parsing directly LC_TYPE to get the codepage wanted.
> ---
>  src/port/chklocale.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/port/chklocale.c b/src/port/chklocale.c
> index a551fdc..a7d88fb 100644
> --- a/src/port/chklocale.c
> +++ b/src/port/chklocale.c
> @@ -203,7 +203,16 @@ win32_langinfo(const char *ctype)
>  {
>  	char	   *r = NULL;
>  
> -#if (_MSC_VER >= 1700)
> +	/*
> +	 * lc_codepage is correctly declared in Visual Studio 2012 and 2013.
> +	 * However in VS 2015 this flag is missing from locale.h, visibly this
> +	 * is an error of refactoring from Microsoft that is at the origin of
> +	 * this missing field, causing a compilation failure in this code path.
> +	 * Hence, it is more reliable to fall back to other code path grabbing

No, the other path can't handle a "locale name" like "initdb --locale=th-TH".
That makes the other code path inadequate for VS2012 and later.  See the
IsoLocaleName() header comment.

> +	 * the codepage from the ctype name itself. If VS gets back this field
> +	 * in the future, we may want to relax the use of _create_locale here.
> +	 */
> +#if (_MSC_VER >= 1700) && (_MSC_VER <= 1800)
>  	_locale_t	loct = NULL;
>  
>  	loct = _create_locale(LC_CTYPE, ctype);


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (134+ messages)  latest in thread

Message-ID: <20160309043137.GA933917@tornado.leadboat.com>
Permalink:  ../20160309043137.GA933917@tornado.leadboat.com/
Also on:    postgresql.org/message-id/20160309043137.GA933917@tornado.leadboat.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: noah@leadboat.com, michael.paquier@gmail.com, andrew@dunslane.net, tgl@sss.pgh.pa.us, petr@2ndquadrant.com, magnus@hagander.net
  Subject: Re: VS 2015 support in src/tools/msvc
  In-Reply-To: <20160309043137.GA933917@tornado.leadboat.com>
  References: <CAB7nPqRL+kuZ8dq6P3WXv-b0-0LAwTxecnaLnvBn4ah7PSbWsQ@mail.gmail.com> <CAB7nPqT8mfN6GoRt4WcNh8WiK==sSh3VkVonRFMzOi6oXefTQw@mail.gmail.com> <56DA6394.9040404@2ndquadrant.com> <CAB7nPqQfoNWGnXjTCf8ZuRtcz0D0fHpE43haoy3CHYgJVf1oDg@mail.gmail.com> <15559.1457156815@sss.pgh.pa.us> <56DAEE74.3010604@dunslane.net> <CAB7nPqSuzGoZPvCUhbDFTkmsD9z6oLAaHeB-yc7_Qb4sh_f-fg@mail.gmail.com> <56DB47A5.7040502@dunslane.net> <CAB7nPqSOL9vLmaecT+SDhkFTOje8erdnvC-KT+dH9_bBQsV5zg@mail.gmail.com> <CAB7nPqRSsrn5etFDEJ+VrWcoxFee8WRBteSgwobKocKQJUFC_A@mail.gmail.com> <20160309043137.GA933917@tornado.leadboat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox