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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
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:49:43
Message-ID: CA+TgmoZBhb6qDZ=0ttHgHL9w4ZJr9eFiO_V=pDTf-_YFX43B7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 9, 2024 at 2:10 PM Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-04-09 18:56:16 Re: simplehash.h: "SH_SCOPE static" causes warnings
Previous Message Robert Haas 2024-04-09 18:46:02 Re: macOS Ventura won't generate core dumps