Re: windows consolidated cleanup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: windows consolidated cleanup
Date: 2011-04-24 16:25:29
Message-ID: 22788.1303662329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> The attached patch is intended to clean up a bunch of compiler warnings
> seen on Windows due to mismatches of signedness or constness, unused
> variables, redefined macros and a missing prototype.

BTW, this hunk:

> *** a/src/pl/plpython/plpython.c
> --- b/src/pl/plpython/plpython.c
> ***************
> *** 84,89 **** typedef int Py_ssize_t;
> --- 84,101 ----
> PyObject_HEAD_INIT(type) size,
> #endif

> + /*
> + * Some Python headers define these two symbols (e.g. on Windows) which is
> + * possibly a bit unfriendly. Use the Postgres definitions (or lack thereof).
> + */
> + #ifdef HAVE_STRERROR
> + #undef HAVE_STRERROR
> + #endif
> +
> + #ifdef HAVE_TZNAME
> + #undef HAVE_TZNAME
> + #endif
> +
> #include "postgres.h"

> /* system stuff */

is indicative of far worse problems than the one it claims to solve.
This file is in fundamental violation of the first commandment of
Postgres #includes, which is "thou shalt have no other gods before c.h".
We need to put postgres.h *before* the Python.h include. I don't know
what issues led to the current arrangement but it is fraught with
portability gotchas. In particular it's just about guaranteed to fail
on platforms where <stdio.h> reacts to _FILE_OFFSET_BITS --- plpython.c
is going to get compiled expecting a different stdio library than the
rest of the backend.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2011-04-24 16:49:31 offline consistency check and info on attributes
Previous Message Tom Lane 2011-04-24 16:14:16 Re: windows consolidated cleanup