pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: tests: Add a test C++ extension module
Date: Tue, 20 Jan 2026 15:43:20 +0000
Message-ID: <E1viDt1-001d7E-2I@gemulon.postgresql.org> (raw)

tests: Add a test C++ extension module

While we already test that our headers are valid C++ using
headerscheck, it turns out that the macros we define might still
expand to invalid C++ code.  This adds a minimal test extension that
is compiled using C++ to test that it's actually possible to build and
run extensions written in C++.  Future commits will improve C++
compatibility of some of our macros and add usage of them to this
extension make sure that they don't regress in the future.

The test module is for the moment disabled when using MSVC.  In
particular, the use of designated initializers in PG_MODULE_MAGIC
would require C++20, for which we are currently not set up.  (GCC and
Clang support it as extensions.)  It is planned to fix this.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail....

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/476b35d4e311a3d77a550280d93393e518908b27

Modified Files
--------------
configure                                          |  8 +++++
configure.ac                                       |  7 ++++
src/Makefile.global.in                             |  2 ++
src/makefiles/meson.build                          |  2 ++
src/test/modules/Makefile                          |  6 ++++
src/test/modules/meson.build                       |  1 +
src/test/modules/test_cplusplusext/.gitignore      |  3 ++
src/test/modules/test_cplusplusext/Makefile        | 26 ++++++++++++++
src/test/modules/test_cplusplusext/README          | 10 ++++++
.../expected/test_cplusplusext.out                 |  7 ++++
src/test/modules/test_cplusplusext/meson.build     | 42 ++++++++++++++++++++++
.../test_cplusplusext/sql/test_cplusplusext.sql    |  3 ++
.../test_cplusplusext/test_cplusplusext--1.0.sql   |  8 +++++
.../test_cplusplusext/test_cplusplusext.control    |  4 +++
.../test_cplusplusext/test_cplusplusext.cpp        | 37 +++++++++++++++++++
15 files changed, 166 insertions(+)



view thread (10+ messages)  latest in thread

Message-ID: <E1viDt1-001d7E-2I@gemulon.postgresql.org>
Permalink:  ../E1viDt1-001d7E-2I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1viDt1-001d7E-2I@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: tests: Add a test C++ extension module
  In-Reply-To: <E1viDt1-001d7E-2I@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox