Re: simplehash.h: "SH_SCOPE static" causes warnings - Mailing list pgsql-hackers

From Andres Freund
Subject Re: simplehash.h: "SH_SCOPE static" causes warnings
Date
Msg-id 20240409185616.nourxxo3gtec4krc@awork3.anarazel.de
Whole thread Raw
In response to [MASSMAIL]simplehash.h: "SH_SCOPE static" causes warnings  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: simplehash.h: "SH_SCOPE static" causes warnings
List pgsql-hackers
Hi,

On 2024-04-09 11:10:15 -0700, Jeff Davis wrote:
> The reason I'm suggesting it there is because the hash table is used
> only for the indexed binary heap, not an ordinary binary heap, so I'd
> like to leave it up to the compiler whether to do any inlining or not.

FWIW, with just about any modern-ish compiler just using "inline" doesn't
actually force inlining, it just changes the cost model to make it more
likely.


> If someone thinks the attached patch is a good change to commit now,
> please let me know. Otherwise, I'll recommend "static inline" in the
> above thread and leave the attached patch to be considered for v18.

I'm not opposed. I'd however at least add a comment explaining why this is
being used. Arguably it doesn't make sense to add it to *_create(), as without
that there really isn't a point in having a simplehash instantiation. Might
make it slightly easier to notice obsoleted uses of simplehash.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: simplehash.h: "SH_SCOPE static" causes warnings
Next
From: Alexander Korotkov
Date:
Subject: Re: post-freeze damage control