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

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: simplehash.h: "SH_SCOPE static" causes warnings
Date: 2024-04-09 19:33:04
Message-ID: db9edf4a83098928b9bbf29bce2f1796ace9c86d.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, 2024-04-09 at 11:56 -0700, Andres Freund wrote:
> 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.

OK.

In the linked thread, I didn't see a good reason to encourage the
compiler to inline the code. Only one caller uses the hash table, so my
instinct would be that the code for maniuplating it should not be
inlined. But "extern" (which is the scope now) is certainly not right,
so "static" made the most sense to me.

>
> 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.

That's a good idea that preserves some utility for the warnings.

Should I go ahead and commit something like that now, or hold it until
the other thread concludes, or hold it until the July CF?

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-04-09 19:42:28 Re: WIP Incremental JSON Parser
Previous Message Jeff Davis 2024-04-09 19:30:36 Re: simplehash.h: "SH_SCOPE static" causes warnings