Here's a more finalized version of this. There are two main interesting
changes here:
1. postgres_fe.h includes common/fe_memutils.h
This means all frontend programs get the #include without having to
do it explicitely by themselves. postgres.h includes utils/palloc.h
which I used as precendent for this.
2. fe_memutils.h includes utils/palloc.h
This means all frontend programs get the palloc() et al prototypes.
Some other things of note:
a. pg_upgrade was using postgres.h all over the place instead of
postgres_fe.h. There's no reason for this AFAICS so I changed it.
No warnings, make check passes.
b. pg_resetxlog is the only frontend place that uses pg_malloc() and
which needs to #include postgres.h instead of postgres_fe.h, so it's
the only place that needs to include fe_memutils.h directly.
(pg_controldata is the other place that includes postgres.h, but it
doesn't need the pg_malloc etc declarations).
c. I added the MSVC bits. I tested that most of it works, but the
various regress executables as well as zic failed to build due to
lack of libpgcommon at link time. I think I fixed it; I'm waiting on
new tests to run. (This patch is the fixed version).
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services