Re: narwhal and PGDLLIMPORT

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: narwhal and PGDLLIMPORT
Date: 2014-02-15 17:47:04
Message-ID: 20140215174704.GJ19470@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-02-15 18:21:56 +0100, Andres Freund wrote:
> On 2014-02-15 12:16:58 -0500, Tom Lane wrote:
> > Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > > On 2014-02-15 10:59:17 -0500, Tom Lane wrote:
> > >> I don't have time right now to research it (have to go shovel snow),
> > >> but I think that at least some of the issue was that we needed the
> > >> externs when we force use of our src/port implementation.
> >
> > > I think that'd be solvable easy enough if we'd just always included pg's
> > > getopt_long.h (or a new getopt.h) which properly deals with defining
> > > them when included. That'd centralize all the magic and it'd overall get
> > > rid of a ton of ifdefs and externs.
> >
> > Yeah, there are enough copies of that stuff that centralizing them
> > sounds like a great idea. Call it "pg_getopt.h", perhaps?
>
> I'm just working on it. pg_getopt.h was exactly what I came up with.
>
> > (1) invent pg_getopt.h, which would #include <getopt.h> if available
> > and then provide properly-ifdef'd externs for optarg and friends;
> > getopt_long.h would #include pg_getopt.h.

Patch attached. I am not sure whether HAVE_GETOPT is the best condition
to use, since it's set by configure by a link based check, same goes for
HAVE_INT_OPTERR. The other choices would be relying on HAVE_GETOPT_H or
a new AC_CHECK_DECL.

I haven't touched entab.c because it's not linking with pgport, so there
seems little use in changing it.

I've also removed some #ifndef WIN32's that didn't seem to make much sense.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
introduce-pg-getopt-header.patch text/x-patch 10.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-02-15 17:50:14 Re: 9.2.1 & index-only scans : abnormal heap fetches after VACUUM FULL
Previous Message Andres Freund 2014-02-15 17:21:56 Re: narwhal and PGDLLIMPORT