From: | David Geier <geidav(dot)pg(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Add explicit casts in four places to simplehash.h |
Date: | 2022-11-03 11:34:41 |
Message-ID: | aa5d88a3-71f4-3455-11cf-82de0372c941@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi hackers,
While working on an extension, I found that simplehash.h is missing
explicit casts in four places. Without these casts, compiling code
including simplehash.h yields warnings if the code is compiled with
-Wc++-compat.
PostgreSQL seems to mostly prefer omitting the explicit casts, however
there are many places where an explicit cast is actually used. Among
many others, see e.g.
bool.c:
state = (BoolAggState *) MemoryContextAlloc(agg_context,
sizeof(BoolAggState));
domains.c:
my_extra = (DomainIOData *) MemoryContextAlloc(mcxt,
sizeof(DomainIOData));
What about, while not being strictly necessary for PostgreSQL itself,
also adding such casts to simplehash.h so that it can be used in code
where -Wc++-compat is enabled?
Attached is a small patch that adds the aforementioned casts.
Thanks for your consideration!
--
David Geier
(ServiceNow)
Attachment | Content-Type | Size |
---|---|---|
0001-Add-explicit-casts-to-simplehash.h.patch | text/x-patch | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2022-11-03 11:40:32 | Re: Incorrect include file order in guc-file.l |
Previous Message | Nikita Malakhov | 2022-11-03 11:33:47 | Re: Pluggable toaster |