Re: Remove useless casts to (void *)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Andreas Karlsson <andreas@proxel.se>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-02T18:06:01Z
Lists: pgsql-hackers
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&stg=make



Commits

  1. Remove PointerIsValid()

  2. Define __EXTENSIONS__ on Solaris, too.

  3. Define _POSIX_C_SOURCE as 200112L on Solaris.

  4. Remove useless casts to (void *)