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

From Bruce Momjian
Subject Re: [HACKERS] Re: include-file cleanup
Date
Msg-id 199907171913.PAA23461@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: include-file cleanup  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Re: include-file cleanup
List 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@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: Re: [HACKERS] Re: include-file cleanup
Next
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] Merging old man pages