Note about include files

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Note about include files
Date: 2000-10-02 09:47:48
Message-ID: Pine.LNX.4.21.0010021135070.931-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The file "postgres.h" (or "c.h" or "config.h", whatever is used) needs to
be the very *first* file included by each source file. Next time you
touch a source file, please check that this is the case.

The obvious failure mode is that if config.h redefines const, volatile, or
inline then it will cause confusion when some system headers are included
before and some after that definition.

The slightly more esoteric problem I encountered is that when you compile
with CC='gcc -std=c99 -pedantic' on a glibc platform (i.e., "Linux") then
you need to define _SVID_SOURCE and _BSD_SOURCE before including any
system header in order to get the full feature set from the headers.

(Unfortunately, the flex output does not observe this rule either, so we
can't be 100% pedantic warning safe without doing surgery on those files.)

On a related note, does anyone know why the on_proc_exit and on_shmem_exit
hooks use a second argument of type `caddr_t' rather than, say, void*,
char*, Datum, ...? This artifact is the cause of about two thirds of the
compile errors in the pedantic setting.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alfred Perlstein 2000-10-02 09:58:38 Re: Note about include files
Previous Message Jeroen van Vianen 2000-10-02 07:57:18 Re: Implementing STDDEV and VARIANCE