Re: Remove useless casts to (void *)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove useless casts to (void *)
Date: 2024-12-02 18:06:01
Message-ID: 1654508.1733162761@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(at)eisentraut(dot)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&stg=make

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2024-12-02 18:39:43 Re: Incorrect result of bitmap heap scan.
Previous Message Alexander Lakhin 2024-12-02 18:00:00 Re: RISC-V animals sporadically produce weird memory-related failures