Re: [HACKERS] include-file unhappiness

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] include-file unhappiness
Date: 1999-01-04 03:28:05
Message-ID: 199901040328.WAA29451@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stan Brown 1999-01-04 03:49:11 Reloading a 6.3db into 6.4.1
Previous Message Tom Lane 1999-01-04 00:55:12 include-file unhappiness