From 59e2476d28fe74b4eed242c7b6e4a5492c07a64b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 15 Sep 2026 08:43:09 +0200 Subject: [PATCH v2 3/8] Adjust unconstify/unvolatize to avoid -Wcast-qual warnings An intermediate cast to uintptr_t avoids the warning. That way, we could turn on -Wcast-qual, and all unconstify() and unvolatize() uses would pass but bare casts that discard qualifiers would raise warnings. --- src/include/c.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/c.h b/src/include/c.h index 341076f06ad..2efdd75cafa 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1379,19 +1379,19 @@ typedef struct PGAlignedXLogBlock PGAlignedXLogBlock; #else /* !__cplusplus */ #define unconstify(underlying_type, expr) \ (StaticAssertVariableIsOfTypeMacro(expr, const underlying_type), \ - (underlying_type) (expr)) + (underlying_type) (uintptr_t) (expr)) #define unvolatize(underlying_type, expr) \ (StaticAssertVariableIsOfTypeMacro(expr, volatile underlying_type), \ - (underlying_type) (expr)) + (underlying_type) (uintptr_t) (expr)) #ifdef __GNUC__ #define unconstify_constexpr(underlying_type, expr) \ __builtin_choose_expr( \ _Generic((expr), const underlying_type: 1, default: 0), \ - (underlying_type) (expr), \ + (underlying_type) (uintptr_t) (expr), \ (void) 0) #else /* !__GNUC_ */ #define unconstify_constexpr(underlying_type, expr) \ - ((underlying_type) (expr)) + ((underlying_type) (uintptr_t) (expr)) #endif /* !__GNUC_ */ #endif /* !__cplusplus */ -- 2.55.0