Re: pgsql: Allow more include files to be compiled in their own by adding m

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Allow more include files to be compiled in their own by adding m
Date: 2011-09-01 11:21:12
Message-ID: 201109011121.p81BLC220991@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Andrew Dunstan wrote:
> >> I'm not sure I understand the point of it anyway.
>
> > The idea is that include files should include all needed includes so
> > they don't spill dependencies into files that use them.
>
> I think that's an unwarranted expansion of the charter of what you're
> doing. There are places where we intentionally do not pull in include
> files that will be required if (and only if) one attempts to make use of
> macros provided by a given header file. The first one that comes to
> mind is in postgres_ext.h:
>
> #define OID_MAX UINT_MAX
> /* you will need to include <limits.h> to use the above #define */
>
> but I believe there are others, and I don't want some mechanical process
> second-guessing those decisions. I think the rule of "should compile on
> its own" is okay, but I don't want that expanded to "every macro
> provided by the file must be expandable with no further includes".

Agreed.

> In the end, the point of what you are doing is to ensure that header
> files can be included in any order. It is not to ensure some sort of
> unclearly-defined closure rule about how many headers need be included
> to make use of a particular facility.

OK.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2011-09-01 11:22:12 Re: pgsql: Allow more include files to be compiled in their own by adding m
Previous Message Heikki Linnakangas 2011-09-01 11:05:00 pgsql: Fix MinGW build, broken by my previous patch to add a setlocale(