Re: warning when compiling utils/tqual.h - Mailing list pgsql-hackers

From Andres Freund
Subject Re: warning when compiling utils/tqual.h
Date
Msg-id 20140317164727.GG16438@awork2.anarazel.de
Whole thread Raw
In response to warning when compiling utils/tqual.h  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: warning when compiling utils/tqual.h
List pgsql-hackers
Hi,


On 2014-03-17 13:40:53 -0300, Alvaro Herrera wrote:
> I noticed (by running "cd src/include ; make check" with the attached
> patch applied) that since commit b89e151054 ("Introduce logical
> decoding.") tqual.h now emits this warning when compiled standalone:

I think we should add such a check (refined to not rely on precompiled
headers) to check-world or something...

> 1. add "struct HTAB;" to the previous line in tqual.h, i.e. a forward
> declaration.  We have very few of these; most of the time ISTM we prefer
> a solution like the next one:

That's what I am for.

We don't have *that* few of those. There's also several cases where
struct pointers are members in other structs. There you don't even need
a forward declaration (like e.g. struct HTAB* in PlannerInfo).

> There is of course a third choice which is to dictate that this function
> ought to be declared in reorderbuffer.h; but that would have the
> unpleasant side-effect that tqual.c would need to #include that.

I am pretty clearly against this.

> Opinions please?  I would like to have a guideline about this so I can
> reason in a principled way in future cases in which this kind of
> question arises.

I'd welcome a clearly stated policy as well. I think forward
declarations are sensible tool if used sparingly, to decouple things
that are primarily related on the implementation level.

Greetings,

Andres Freund

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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: warning when compiling utils/tqual.h
Next
From: Tom Lane
Date:
Subject: Re: warning when compiling utils/tqual.h