Re: [HACKERS] Re: include-file cleanup

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: include-file cleanup
Date: 1999-07-17 19:13:41
Message-ID: 199907171913.PAA23461@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> A further thought on the include-file cleanup: although you are right to
> be wary of removing includes of system files, it would be a good idea to
> remove *redundant* includes of system files.
>
> In particular, since c.h includes <stdlib.h>, as well as <stddef.h>
> and <stdarg.h> if they exist, it should not be necessary for any file
> that includes c.h (either directly or via postgres.h) to pull these
> in for itself. Removing the "retail" inclusions of these files that
> are found in many source files would make life much easier for anyone
> trying to port to a platform where they don't exist...

The problem is that we include system includes first. Are there any
system includes that require stdlib to be included first?

OK, now you got me started again. And I was going to do some real
paying work today. :-)

I have removed the duplicate system headers when postgres.h is included,
and have added string.h and stdio.h to c.h, and have removed those from
the files. Now, many C files have _no_ system includes, because they
come from postgres.h including c.h.

You know, at the time, this seems like a real pain, just like pgindent
was a pain to get working properly. But in a year, you look back and
say, "Hey, it was worth it. Look at how much easier things are now."

I will commit the changes now.

> Also, I think some places include c.h without having included
> postgres.h. These should be checked to ensure that config.h has
> been included first --- c.h depends on configuration symbols from
> config.h to work properly.

postgres.h include c.h, and config.h _now_ includes c.h.

--
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 Thomas Lockhart 1999-07-17 20:54:25 Re: [HACKERS] Merging old man pages
Previous Message Tom Lane 1999-07-17 17:56:11 Re: [HACKERS] Re: include-file cleanup