pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Andreas Karlsson <andreas@proxel.se>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Remove useless casts to (void *)
Date: Mon, 02 Dec 2024 13:06:01 -0500
Message-ID: <1654508.1733162761@sss.pgh.pa.us> (raw)
In-Reply-To: <8da4a1fc-5cd3-4414-a8a1-57929b85285c@eisentraut.org>
References: <461ea37c-8b58-43b4-9736-52884e862820@eisentraut.org>
	<166213.1730211603@sss.pgh.pa.us>
	<3ab19dcf-7ca5-4de0-89b0-1ee344a42105@eisentraut.org>
	<c52898e7-b138-4c73-9ff1-52c7572c3f4b@proxel.se>
	<8da4a1fc-5cd3-4414-a8a1-57929b85285c@eisentraut.org>

Peter Eisentraut <peter@eisentraut.org> writes:
> Committed, thanks.

Now that we have a more-or-less full set of buildfarm results
on this, I checked for new warnings, and found two:

pg_shmem.c: In function 'PGSharedMemoryIsInUse':
pg_shmem.c:323:33: warning: passing argument 1 of 'shmdt' from incompatible pointer type [-Wincompatible-pointer-types]
  323 |         if (memAddress && shmdt(memAddress) < 0)
      |                                 ^~~~~~~~~~
      |                                 |
      |                                 PGShmemHeader *
In file included from pg_shmem.c:27:
/usr/include/sys/shm.h:131:11: note: expected 'char *' but argument is of type 'PGShmemHeader *'
  131 | int shmdt(char *);
      |           ^~~~~~
pg_shmem.c: In function 'PGSharedMemoryCreate':
pg_shmem.c:838:37: warning: passing argument 1 of 'shmdt' from incompatible pointer type [-Wincompatible-pointer-types]
  838 |                 if (oldhdr && shmdt(oldhdr) < 0)
      |                                     ^~~~~~
      |                                     |
      |                                     PGShmemHeader *
/usr/include/sys/shm.h:131:11: note: expected 'char *' but argument is of type 'PGShmemHeader *'
  131 | int shmdt(char *);
      |           ^~~~~~

This is from hake[1], which is running OpenIndiana/illumos.
That platform shows a couple of other strange warnings, so maybe
re-eliminating these two is not worth worrying about, but
nonetheless the casts to void * were doing something here.

			regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=hake&dt=2024-12-02%2017%3A19%3A40&...





view thread (27+ messages)  latest in thread

Message-ID: <1654508.1733162761@sss.pgh.pa.us>
Permalink:  ../1654508.1733162761@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1654508.1733162761@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org, andreas@proxel.se
  Subject: Re: Remove useless casts to (void *)
  In-Reply-To: <1654508.1733162761@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox