pgsql: Reduce the scope of volatile qualifiers

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reduce the scope of volatile qualifiers
Date: 2026-03-03 09:08:42
Message-ID: E1vxLkA-0028qf-0f@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reduce the scope of volatile qualifiers

Commit c66a7d75e652 introduced a new "cast discards ‘volatile’"
warning (-Wcast-qual) in vac_truncate_clog().

Instead of making use of unvolatize(), remove the warning by reducing the
scope of the volatile qualifier (added in commit 2d2e40e3bef) to only
2 fields.

Also do the same for vac_update_datfrozenxid(), since the intent of
commit f65ab862e3b was to prevent the same kind of race condition that
commit 2d2e40e3bef was fixing.

Author: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Suggested-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/aZ3a%2BV82uSfEjDmD%40ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

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

Modified Files
--------------
src/backend/commands/vacuum.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-03-03 12:11:52 pgsql: Reduce scope of for-loop-local variables to avoid shadowing
Previous Message Peter Eisentraut 2026-03-03 06:37:25 pgsql: Add COPY (on_error set_null) option