pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Started by Tom Lanealmost 12 years ago6 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
must be able to compile in a "#define FRONTEND" context. It appears that
Solaris Studio is smart enough to persuade us to define PG_USE_INLINE,
but not smart enough to not make a copy of unreferenced static functions;
which leads to an unsatisfied reference to CurrentMemoryContext. So we
need an #ifndef FRONTEND around that declaration. Per buildfarm.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/36825f38dd44d8630b07be843dfc1619fe9f8d5c

Modified Files
--------------
src/include/utils/palloc.h | 7 +++++++
1 file changed, 7 insertions(+)

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

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#1)
Re: pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Tom Lane wrote:

Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
must be able to compile in a "#define FRONTEND" context.

Hmm, I had this patch in an abandoned branch from long ago, which I
think helped remove postgres.h from pg_controldata. I remembered it
just now because of this commit message. Maybe it's useful to re-remove
the #ifndef FRONTEND from palloc.h.

It's not rebased to latest master and maybe even not complete; if people
think this approach is worthwhile I can try and clean it up and
proposely more seriously; LMK. (Also if people think it needs futher
tweaks. I vaguely recall I didn't propose it back then because the set
of stuff in the new header could be tweaked.)

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

xlogproc.patchtext/x-diff; charset=us-asciiDownload+46-26
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#2)
Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

Tom Lane wrote:

pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
must be able to compile in a "#define FRONTEND" context.

Hmm, I had this patch in an abandoned branch from long ago, which I
think helped remove postgres.h from pg_controldata. I remembered it
just now because of this commit message. Maybe it's useful to re-remove
the #ifndef FRONTEND from palloc.h.

Hm. It would certainly be better if pg_controldata could use
postgres_fe.h not postgres.h, but I'm confused about how the new header
added by this patch helps that? None of the declarations you removed from
xlog.h look like they'd be more problematic than the ones you left behind.

regards, tom lane

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

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#3)
Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Tom Lane wrote:

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

Tom Lane wrote:

pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
must be able to compile in a "#define FRONTEND" context.

Hmm, I had this patch in an abandoned branch from long ago, which I
think helped remove postgres.h from pg_controldata. I remembered it
just now because of this commit message. Maybe it's useful to re-remove
the #ifndef FRONTEND from palloc.h.

Hm. It would certainly be better if pg_controldata could use
postgres_fe.h not postgres.h, but I'm confused about how the new header
added by this patch helps that? None of the declarations you removed from
xlog.h look like they'd be more problematic than the ones you left behind.

The point IIRC was to be able to remove stuff that required type Datum
to be defined:

-extern void ShutdownXLOG(int code, Datum arg);

which led to the idea that the new header would be about process control
for xlog.c.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#4)
Re: Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

Tom Lane wrote:

Hm. It would certainly be better if pg_controldata could use
postgres_fe.h not postgres.h, but I'm confused about how the new header
added by this patch helps that? None of the declarations you removed from
xlog.h look like they'd be more problematic than the ones you left behind.

The point IIRC was to be able to remove stuff that required type Datum
to be defined:

-extern void ShutdownXLOG(int code, Datum arg);

which led to the idea that the new header would be about process control
for xlog.c.

Oh, Datum was the issue? I see. But then this approach is basically
requiring that we can never reference Datum in any header that
pg_controldata uses. Which seems like a pretty draconian limitation,
particularly if the headers involved are general-purpose ones like xlog.h.

What might be less breakable is to identify exactly which declarations
pg_controldata needs out of this file and push just those into some new
header.

However, pg_controldata is just the tip of the iceberg --- to get any
mileage out of this, we'd also have to make pg_resetxlog and pg_xlogdump
able to compile with only postgres_fe.h, so there might be too much stuff
involved.

regards, tom lane

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

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#5)
Re: Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

Tom Lane wrote:

What might be less breakable is to identify exactly which declarations
pg_controldata needs out of this file and push just those into some new
header.

Yeah, I also thought about that but didn't get around to trying.

However, pg_controldata is just the tip of the iceberg --- to get any
mileage out of this, we'd also have to make pg_resetxlog and pg_xlogdump
able to compile with only postgres_fe.h, so there might be too much stuff
involved.

IIRC we didn't have pg_xlogdump when I wrote this, and I checked
pg_resetxlog and it wasn't nearly as simple as pg_controldata.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

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