v1-0001-PG_MODULE_MAGIC_DATA-0-mixes-designated-and-non-desi.patch

application/octet-stream

Filename: v1-0001-PG_MODULE_MAGIC_DATA-0-mixes-designated-and-non-desi.patch
Type: application/octet-stream
Part: 0
Message: Re: Add Postgres module info

Patch

Format: format-patch
Series: patch v1-0001
Subject: PG_MODULE_MAGIC_DATA(0) mixes designated and non-designated initializers
File+
src/include/fmgr.h 1 1
From 63e20d3270ac5cee57a4c0cfdc988b17401509a1 Mon Sep 17 00:00:00 2001
From: Yurii Rashkovskii <yrashk@gmail.com>
Date: Thu, 27 Mar 2025 06:13:21 -0700
Subject: [PATCH] PG_MODULE_MAGIC_DATA(0) mixes designated and non-designated
 initializers

This is allowed in C but not in C++ and C++ exensions include headers,
and this is causing compilers to error out (GCC) or issue a warning (Clang).

Use designated initializers exclusively to counteract this issue.
---
 src/include/fmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 853870d3abf..0fe7b4ebc77 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -522,7 +522,7 @@ extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \
 const Pg_magic_struct * \
 PG_MAGIC_FUNCTION_NAME(void) \
 { \
-	static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA(0); \
+	static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA(.name = NULL); \
 	return &Pg_magic_data; \
 } \
 extern int no_such_variable
-- 
2.39.5 (Apple Git-154)