Re: pg_filedump 9.3: checksums (and a few other fixes) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg_filedump 9.3: checksums (and a few other fixes)
Date
Msg-id 20130614160736.GI19500@alap2.anarazel.de
Whole thread Raw
In response to Re: pg_filedump 9.3: checksums (and a few other fixes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_filedump 9.3: checksums (and a few other fixes)
List pgsql-hackers
On 2013-06-14 11:59:04 -0400, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.com> writes:
> > I have a question about the commit though: shouldn't both functions be
> > static if they are in a .h file? Otherwise, it could lead to naming
> > conflicts. I suppose it's wrong to include the implementation file
> > twice, but it still might be confusing if someone tries. Two ideas that
> > come to mind are:
> >   * make both static and then have a trivial wrapper in checksum.c
> >   * export one or both functions, but use #ifndef CHECKSUM_IMPL_H to
> > prevent redefinition
> 
> Ah, you are right, I forgot the #ifndef CHECKSUM_IMPL_H dance.  Will fix
> in a bit.

That won't help against errors if it's included in two different
files/translation units though. I don't really see a valid case where it
could be validly be included multiple times in one TU?
If anything we should #error in that case, but I am not sure it's worth
bothering.
E.g. in rmgrlist.h we have the following comment:
/* there is deliberately not an #ifndef RMGRLIST_H here */
and I think the reasoning behind that comment applies here as well.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: refresh materialized view concurrently
Next
From: Jeff Davis
Date:
Subject: Re: Patch for fail-back without fresh backup