Unix Technical Forum

Headers dependencies cleanup

This is a discussion on Headers dependencies cleanup within the Pgsql Patches forums, part of the PostgreSQL category; --> During my work I found some header files, which include useless headers and on other way there are some ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 07:21 AM
Zdenek Kotala
 
Posts: n/a
Default Headers dependencies cleanup

During my work I found some header files, which include useless headers
and on other way there are some headers which silently assume that
requested header will be included by some other headers file.

This patch fixes these dependencies around bufpage.h, bufmgr.h


Zdenek


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 07:27 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Headers dependencies cleanup

Zdenek Kotala wrote:
> During my work I found some header files, which include useless headers
> and on other way there are some headers which silently assume that
> requested header will be included by some other headers file.
>
> This patch fixes these dependencies around bufpage.h, bufmgr.h


What's the point here, again?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 07:27 AM
Tom Lane
 
Posts: n/a
Default Re: Headers dependencies cleanup

Alvaro Herrera <alvherre@commandprompt.com> writes:
> Zdenek Kotala wrote:
>> During my work I found some header files, which include useless headers
>> and on other way there are some headers which silently assume that
>> requested header will be included by some other headers file.
>>
>> This patch fixes these dependencies around bufpage.h, bufmgr.h


> What's the point here, again?


Bruce periodically runs a script that's supposed to catch this type
of problem. Maybe we are overdue for another run?

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2008, 07:27 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Headers dependencies cleanup

Alvaro Herrera napsal(a):
> Zdenek Kotala wrote:
>> During my work I found some header files, which include useless headers
>> and on other way there are some headers which silently assume that
>> requested header will be included by some other headers file.
>>
>> This patch fixes these dependencies around bufpage.h, bufmgr.h

>
> What's the point here, again?
>


Main point there is bufpage.h I have needed include this header in page layout
convector but it include bufmgr.h which is useless there and generates a lot of
another dependences (e.g. on fmgr.h). Other changes are related to this change.


Zdenek

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-19-2008, 07:27 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Headers dependencies cleanup

Tom Lane napsal(a):
> Alvaro Herrera <alvherre@commandprompt.com> writes:
>> Zdenek Kotala wrote:
>>> During my work I found some header files, which include useless headers
>>> and on other way there are some headers which silently assume that
>>> requested header will be included by some other headers file.
>>>
>>> This patch fixes these dependencies around bufpage.h, bufmgr.h

>
>> What's the point here, again?

>
> Bruce periodically runs a script that's supposed to catch this type
> of problem. Maybe we are overdue for another run?
>


Yes, but This problem is there for long time and I think Bruce's script does not
catch it.

Zdenek

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-19-2008, 07:27 AM
Tom Lane
 
Posts: n/a
Default Re: Headers dependencies cleanup

Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>>> During my work I found some header files, which include useless headers
>>> and on other way there are some headers which silently assume that
>>> requested header will be included by some other headers file.

>>
>> Bruce periodically runs a script that's supposed to catch this type
>> of problem. Maybe we are overdue for another run?


> Yes, but This problem is there for long time and I think Bruce's script does not
> catch it.


Exactly what problem do you see that he didn't catch?

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-19-2008, 07:27 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Headers dependencies cleanup

Tom Lane napsal(a):
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>>>> During my work I found some header files, which include useless headers
>>>> and on other way there are some headers which silently assume that
>>>> requested header will be included by some other headers file.
>>> Bruce periodically runs a script that's supposed to catch this type
>>> of problem. Maybe we are overdue for another run?

>
>> Yes, but This problem is there for long time and I think Bruce's script does not
>> catch it.

>
> Exactly what problem do you see that he didn't catch?


bufpage.h includes bufmgr.h, but bufpage.h does not require any definition from
bufmgr.h. I think this dependency is there for long time.

Zdenek

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-19-2008, 07:27 AM
Bruce Momjian
 
Posts: n/a
Default Re: Headers dependencies cleanup

Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Zdenek Kotala wrote:
> >> During my work I found some header files, which include useless headers
> >> and on other way there are some headers which silently assume that
> >> requested header will be included by some other headers file.
> >>
> >> This patch fixes these dependencies around bufpage.h, bufmgr.h

>
> > What's the point here, again?

>
> Bruce periodically runs a script that's supposed to catch this type
> of problem. Maybe we are overdue for another run?


Last run was July, 2006:

revision 1.48
date: 2006/07/13 18:01:01; author: momjian; state: Exp; lines: +1 -2
More include file adjustments.
----------------------------
revision 1.47
date: 2006/07/13 17:47:01; author: momjian; state: Exp; lines: +2 -1
More include file adjustments.
----------------------------
revision 1.46
date: 2006/07/13 16:49:19; author: momjian; state: Exp; lines: +2 -1
Allow include files to compile own their own.

Strip unused include files out unused include files, and add needed
includes to C files.

I run it every few years rather than every year because it can break
stuff that we have to manually fix by adding includes.

If you want it run now or every year, let me know.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-19-2008, 07:27 AM
Bruce Momjian
 
Posts: n/a
Default Re: Headers dependencies cleanup

Zdenek Kotala wrote:
> Tom Lane napsal(a):
> > Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> >>>> During my work I found some header files, which include useless headers
> >>>> and on other way there are some headers which silently assume that
> >>>> requested header will be included by some other headers file.
> >>> Bruce periodically runs a script that's supposed to catch this type
> >>> of problem. Maybe we are overdue for another run?

> >
> >> Yes, but This problem is there for long time and I think Bruce's script does not
> >> catch it.

> >
> > Exactly what problem do you see that he didn't catch?

>
> bufpage.h includes bufmgr.h, but bufpage.h does not require any definition from
> bufmgr.h. I think this dependency is there for long time.


My scripts should have found this issue, see
src/tools/pginclude/pgrminclude.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-19-2008, 07:27 AM
Tom Lane
 
Posts: n/a
Default Re: Headers dependencies cleanup

Bruce Momjian <bruce@momjian.us> writes:
> Zdenek Kotala wrote:
>> bufpage.h includes bufmgr.h, but bufpage.h does not require any definition from
>> bufmgr.h. I think this dependency is there for long time.


> My scripts should have found this issue, see
> src/tools/pginclude/pgrminclude.


Looking over the file more closely, I disagree with Zdenek's claim
anyway. Even though the file could physically be scanned without
having included bufmgr.h first, many of the macros it defines can't
be used without bufmgr.h, and so that file really is a prerequisite.
If we removed the include here it would just have to pop up in
calling .c files. Anyplace that that was solely because of calling
one of the macros defined by bufpage.h, rather than explicitly using
anything from bufmgr.h, I claim it'd be wrong.

This example makes me question using scripts for this type of
maintenance, though, as it's not clear that a does-it-compile test
would understand macro dependencies.

It's probably true that we've let the header inclusions in storage/
and access/ get a bit spaghetti-ish. But I think that if we're going
to do something about it, focusing on one or two files is not the
way to start. What we need is for someone to go through all those
files and propose a clear layering of them. This will very likely
involve having to move some declarations around, when we realize
something got put in a poorly chosen place.

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:51 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com