Make use of unvolatize() in vac_truncate_clog()

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Make use of unvolatize() in vac_truncate_clog()
Date: 2026-02-24 17:08:09
Message-ID: aZ3a+V82uSfEjDmD@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

while reviewing [1], I noticed a remaining "cast discards ‘volatile’" outside of
c.h:

$ grep " warning: cast discards ‘volatile’" make.log
vacuum.c:1885:46: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1263:10: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1039:35: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1039:35: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1263:10: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1263:10: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
c.h:1263:10: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]

That indicated that unvolatize() is not being used in vacuum.c. Indeed, 481018f2804
introduced unvolatize() but its usage has been missed in c66a7d75e652.

This patch makes use of unvolatize() in vac_truncate_clog().

Note that it does not remove the warning but moves it to c.h (where unvolatize()
is defined) but that's consistent with what 481018f2804 did too.

[1]: https://postgr.es/m/aZw4fcj1qBYgN41V%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Make-use-of-unvolatize-in-vac_truncate_clog.patch text/x-diff 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-02-24 17:13:09 Re: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
Previous Message Álvaro Herrera 2026-02-24 17:08:04 Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)