Re: simplehash.h: "SH_SCOPE static" causes warnings

From: Andres Freund <andres(at)anarazel(dot)de>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: simplehash.h: "SH_SCOPE static" causes warnings
Date: 2024-04-09 18:56:16
Message-ID: 20240409185616.nourxxo3gtec4krc@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-04-09 19:14:35 Re: post-freeze damage control
Previous Message Robert Haas 2024-04-09 18:49:43 Re: simplehash.h: "SH_SCOPE static" causes warnings