Add explicit casts in four places to simplehash.h
David Geier <geidav.pg@gmail.com>
From: David Geier <geidav.pg@gmail.com>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-03T11:34:41Z
Lists: pgsql-hackers
Attachments
- 0001-Add-explicit-casts-to-simplehash.h.patch (text/x-patch) patch 0001
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)
Commits
-
Add casts to simplehash.h to silence C++ warnings.
- eeb5461e76ae 14.6 landed
- cf8b7d374ae1 16.0 landed
- 725cd4d2e481 15.1 landed
- 50467082c9d4 13.9 landed