Andres Freund <andres@anarazel.de> writes:
> On 2021-10-22 16:32:39 -0400, Tom Lane wrote:
>> Hmm, harder than it sounds. If I remove "inline" from SH_SCOPE then
>> the compiler complains about unreferenced static functions, while
>> if I leave it there than adding pg_noinline causes a complaint about
>> conflicting options.
> The easy way out would be to to not declare SH_GROW inside SH_DECLARE - that'd
> currently work, because there aren't any calls to grow from outside of
> simplehash.h.
Seems like a reasonable approach. If somebody wanted to call that
from outside, I'd personally feel they were getting way too friendly
with the implementation.
>> Seems like we need a less quick-and-dirty approach to dealing with
>> unnecessary simplehash support functions.
> I don't think the problem is unnecessary ones?
I was thinking about the stuff like SH_ITERATE, which you might or
might not have use for in any particular file. In the case at hand
here, a file that doesn't call SH_INSERT would be at risk of getting
unused-function complaints about SH_GROW. But as you say, if we do
find that happening, __attribute__((unused)) would probably be
enough to silence it.
regards, tom lane