Move NON_EXEC_STATIC from c.h

Started by Peter Eisentrautover 3 years ago4 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Looking to tidy up c.h a bit, I think the NON_EXEC_STATIC #define
doesn't need to be known globally, and it's not related to establishing
a portable C environment, so I propose to move it to a more localized
header, such as postmaster.h, as in the attached patch.

Attachments:

0001-Move-NON_EXEC_STATIC-from-c.h-to-postmaster.h.patchtext/plain; charset=UTF-8; name=0001-Move-NON_EXEC_STATIC-from-c.h-to-postmaster.h.patchDownload+7-8
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Move NON_EXEC_STATIC from c.h

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

Looking to tidy up c.h a bit, I think the NON_EXEC_STATIC #define
doesn't need to be known globally, and it's not related to establishing
a portable C environment, so I propose to move it to a more localized
header, such as postmaster.h, as in the attached patch.

Hmm, postgres.h seems like a better choice, since in principle any
backend file might need this. This arrangement could require
postmaster.h to be included just for this macro.

Also, the macro was severely underdocumented already, and I don't
find "no comment at all" to be better. Can't we afford a couple
of lines of explanation?

regards, tom lane

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#2)
Re: Move NON_EXEC_STATIC from c.h

On 16.08.22 15:50, Tom Lane wrote:

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

Looking to tidy up c.h a bit, I think the NON_EXEC_STATIC #define
doesn't need to be known globally, and it's not related to establishing
a portable C environment, so I propose to move it to a more localized
header, such as postmaster.h, as in the attached patch.

Hmm, postgres.h seems like a better choice, since in principle any
backend file might need this. This arrangement could require
postmaster.h to be included just for this macro.

I picked postmaster.h because the other side of the code, where the
no-longer-static symbols are used, is in postmaster.c. But postgres.h
is also ok.

Also, the macro was severely underdocumented already, and I don't
find "no comment at all" to be better. Can't we afford a couple
of lines of explanation?

Here is a new patch with more comments.

Attachments:

v2-0001-Move-NON_EXEC_STATIC-from-c.h-to-postgres.h.patchtext/plain; charset=UTF-8; name=v2-0001-Move-NON_EXEC_STATIC-from-c.h-to-postgres.h.patchDownload+20-8
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#3)
Re: Move NON_EXEC_STATIC from c.h

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

Here is a new patch with more comments.

LGTM

regards, tom lane