Re: [HACKERS] include-file unhappiness - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] include-file unhappiness
Date
Msg-id 199901040328.WAA29451@candle.pha.pa.us
Whole thread Raw
In response to include-file unhappiness  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I've been tweaking the current sources to make them compile on HPUX 9
> again (right now they don't, for lack of vsnprintf() in libc).  All
> went well until I tried to get rid of gcc's compile warnings about
> lack of a prototype for snprintf & vsnprintf.  I put
> 
> #ifndef HAVE_SNPRINTF
> extern int snprintf(char *str, size_t count, const char *fmt, ...);
> #endif
> 
> #ifndef HAVE_VSNPRINTF
> extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
> #endif
> 
> into include/c.h (they can't readily go into config.h because config.h
> doesn't include any system header that defines size_t or va_list).
> 
> That almost works, but there are a few files that blow up because
> they include c.h without having included config.h beforehand.
> 
> Now I maintain that every file that uses *any* of the Postgres
> include files ought to include config.h.  Not doing so is a recipe
> for trouble as we become more and more dependent on autoconf.
> So I propose changing these files to include postgres.h instead of
> just including c.h directly:
> 
> contrib/fulltextindex/fti.c
> src/backend/port/dynloader/aix.c
> src/backend/port/dynloader/hpux.c
> src/backend/port/dynloader/ultrix4.c
> src/backend/storage/buffer/s_lock.c
> src/backend/utils/error/format.c
> src/backend/utils/mmgr/oset.c
> src/backend/utils/mmgr/palloc.c
> src/include/libpq/pqcomm.h
> src/interfaces/libpq/pqsignal.h

Go ahead.  Good reasoning for doing this.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: include-file unhappiness
Next
From: "Stan Brown"
Date:
Subject: Reloading a 6.3db into 6.4.1