Remove unnecessary volatile qualifiers.

This commit cleans up volatile qualifiers that fit the below
criteria:

* Accesses to shared memory protected by a spinlock or LWLock.
Before commit 0709b7ee72, callers had to use volatile when
accessing spinlock-protected shared memory.  Since spinlock
acquire/release became compiler barriers, and because LWLocks
provide the same guarantee, that is no longer necessary.  These
either predate that change or were cargo-culted from code that did.

* Pointers used only to find the address of a member.  The volatile
qualifier only affects accesses made by dereferencing the pointer,
so it is unnecessary there.

* Accesses to struct members that are marked volatile in the struct
definition.  There's no need to mark these pointers volatile,
either.

* Leftovers from removed PG_TRY blocks.  These were marked volatile
to protect a value that is modified inside a PG_TRY block, but the
PG_TRY has since been removed.

Reviewed-by: Heikki Linnakangas <[email protected]>
Discussion: https://postgr.es/m/akQ5eJR1tCCXme8e%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b34fd845e03aea7401d3bf403c87e171d10f7709

Modified Files
--------------
src/backend/access/transam/clog.c     |  7 +++----
src/backend/catalog/index.c           |  2 +-
src/backend/commands/async.c          |  4 ++--
src/backend/replication/syncrep.c     | 19 ++++++++-----------
src/backend/storage/ipc/procsignal.c  |  8 ++++----
src/backend/storage/ipc/shm_toc.c     | 31 ++++++++++++++-----------------
src/backend/storage/lmgr/lock.c       |  2 +-
src/backend/storage/lmgr/proc.c       |  3 +--
src/test/modules/test_shm_mq/setup.c  |  4 ++--
src/test/modules/test_shm_mq/worker.c |  2 +-
10 files changed, 37 insertions(+), 45 deletions(-)

Reply via email to