From e4031bae0878602bc440c42d11fabdcbe2b76dc1 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Tue, 3 Feb 2026 10:50:20 +0000
Subject: [PATCH v1 2/3] Change StaticAssertStmt to StaticAssertDecl in
 deadlock.c

Changing the StaticAssertStmt to StaticAssertDecl and keep in the function scope.

Adding new braces to avoid Wdeclaration-after-statement to trigger.
---
 src/backend/storage/lmgr/deadlock.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
 100.0% src/backend/storage/lmgr/

diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c
index 8334a887618..fa03e50ce80 100644
--- a/src/backend/storage/lmgr/deadlock.c
+++ b/src/backend/storage/lmgr/deadlock.c
@@ -192,11 +192,13 @@ InitDeadLockChecking(void)
 	 * last MaxBackends entries in possibleConstraints[] are reserved as
 	 * output workspace for FindLockCycle.
 	 */
-	StaticAssertStmt(MAX_BACKENDS_BITS <= (32 - 3),
-					 "MAX_BACKENDS_BITS too big for * 4");
-	maxPossibleConstraints = MaxBackends * 4;
-	possibleConstraints =
-		(EDGE *) palloc(maxPossibleConstraints * sizeof(EDGE));
+	{
+		StaticAssertDecl(MAX_BACKENDS_BITS <= (32 - 3),
+						 "MAX_BACKENDS_BITS too big for * 4");
+		maxPossibleConstraints = MaxBackends * 4;
+		possibleConstraints =
+			(EDGE *) palloc(maxPossibleConstraints * sizeof(EDGE));
+	}
 
 	MemoryContextSwitchTo(oldcxt);
 }
-- 
2.34.1

