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

From Jeff Davis
Subject Re: simplehash.h: "SH_SCOPE static" causes warnings
Date
Msg-id db9edf4a83098928b9bbf29bce2f1796ace9c86d.camel@j-davis.com
Whole thread Raw
In response to Re: simplehash.h: "SH_SCOPE static" causes warnings  (Andres Freund <andres@anarazel.de>)
Responses Re: simplehash.h: "SH_SCOPE static" causes warnings
List 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




pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: simplehash.h: "SH_SCOPE static" causes warnings
Next
From: Andrew Dunstan
Date:
Subject: Re: WIP Incremental JSON Parser