Re: Splitting up guc.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Splitting up guc.c
Date: 2022-09-10 19:23:40
Message-ID: 597492.1662837820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2022-09-10 15:04:59 -0400, Tom Lane wrote:
>> $ size guc*o
>> text data bss dec hex filename
>> 13653 4 112 13769 35c9 guc-file.o
>> 54953 0 564 55517 d8dd guc.o
>> 6951 0 112 7063 1b97 guc_hooks.o
>> 43570 62998 216 106784 1a120 guc_tables.o

> A tad surprised by the text size of guc_tables.o - not that it is a problem,
> just seems a bit odd.

There's a pretty fair number of constant tables that got moved to there.
Not to mention all the constant strings.

>> Before proceeding further, I wanted to ask for comments on a design
>> choice that might be controversial. Even though I don't want to
>> invent guc_hooks.c, I think we *should* invent guc_hooks.h, and
>> consolidate all the GUC hook function declarations there. The
>> point would be to not have to #include guc.h in headers of unrelated
>> modules. This is similar to what we've done with utils/fmgrprotos.h,
>> though the motivation is different. I already moved a few declarations
>> from guc.h to there (and in consequence had to adjust #includes in
>> the modules defining those hooks), but there's a lot more to be done
>> if we apply that policy across the board. Does anybody think that's
>> a bad approach, or have a better one?

> Hm, I'm not opposed, the reasoning makes sense to me. How would this interact
> with the declaration of the variables underlying GUCs?

I'd still declare the variables as we do now, ie just straightforwardly
export them from the associated modules. Since they're all of native
C types, they don't cause any inclusion-footprint issues. We could move
their declarations to a common file I guess, but I don't see any benefit.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-09-10 19:24:40 Re: Splitting up guc.c
Previous Message Andres Freund 2022-09-10 19:15:33 Re: Splitting up guc.c