Re: warning when compiling utils/tqual.h

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: warning when compiling utils/tqual.h
Date: 2014-03-17 16:47:27
Message-ID: 20140317164727.GG16438@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-03-17 16:50:37 Re: warning when compiling utils/tqual.h
Previous Message Alvaro Herrera 2014-03-17 16:40:53 warning when compiling utils/tqual.h