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

From Robert Haas
Subject Re: simplehash.h: "SH_SCOPE static" causes warnings
Date
Msg-id CA+TgmoZBhb6qDZ=0ttHgHL9w4ZJr9eFiO_V=pDTf-_YFX43B7Q@mail.gmail.com
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
On Tue, Apr 9, 2024 at 2:10 PM Jeff Davis <pgsql@j-davis.com> wrote:
> If using "SH_SCOPE static" with simplehash.h, it causes a bunch of
> warnings about functions that are defined but not used. It's simple
> enough to fix by appending pg_attribute_unused() to the declarations
> (attached).

Hmm. I'm pretty sure that I've run into this problem, but I concluded
that I should use either "static inline" or "extern" and didn't think
any more of it. I'm not sure that I like the idea of just ignoring the
warnings, for fear that the compiler might not actually remove the
code for the unused functions from the resulting binary. But I'm not
an expert in this area either, so maybe I'm wrong.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: macOS Ventura won't generate core dumps
Next
From: Andres Freund
Date:
Subject: Re: simplehash.h: "SH_SCOPE static" causes warnings