Compound literals, as used in pg_list.h for list_makeN(), are not a
C++ feature. MSVC doesn't accept these. (GCC and Clang accept them,
but they would warn in -pedantic mode.) Replace with equivalent
inline functions. (These are the only instances of compound literals
used in PostgreSQL header files.)
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com
/*
* Convenience macros for building fixed-length lists
*/
-#define list_make_ptr_cell(v) ((ListCell) {.ptr_value = (v)})
-#define list_make_int_cell(v) ((ListCell) {.int_value = (v)})
-#define list_make_oid_cell(v) ((ListCell) {.oid_value = (v)})
-#define list_make_xid_cell(v) ((ListCell) {.xid_value = (v)})
+
+static inline ListCell
+list_make_ptr_cell(void *v)
+{
+ ListCell c;
+
+ c.ptr_value = v;
+ return c;
+}
+
+static inline ListCell
+list_make_int_cell(int v)
+{
+ ListCell c;
+
+ c.int_value = v;
+ return c;
+}
+
+static inline ListCell
+list_make_oid_cell(Oid v)
+{
+ ListCell c;
+
+ c.oid_value = v;
+ return c;
+}
+
+static inline ListCell
+list_make_xid_cell(TransactionId v)
+{
+ ListCell c;
+
+ c.xid_value = v;
+ return c;
+}
#define list_make1(x1) \
list_make1_impl(T_List, list_make_ptr_cell(x1))