From e82fc27e095b5a84c578b6e6b43b3396463bd812 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 18 Mar 2026 11:25:47 +0100 Subject: [PATCH] meson: Add headerscheck and cpluspluscheck targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: MiƂosz Bieniek Co-authored-by: Peter Eisentraut Reviewed-by: Bilal Yavuz Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com --- doc/src/sgml/targets-meson.txt | 2 ++ meson.build | 15 +++++++++++++++ src/tools/pginclude/README | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/doc/src/sgml/targets-meson.txt b/doc/src/sgml/targets-meson.txt index 397c103d72c..05df077cffc 100644 --- a/doc/src/sgml/targets-meson.txt +++ b/doc/src/sgml/targets-meson.txt @@ -17,6 +17,8 @@ Developer Targets: reformat-dat-files Rewrite catalog data files into standard format expand-dat-files Expand all data files to include defaults update-unicode Update Unicode data to new version + headerscheck Check that all headers compile standalone + cpluspluscheck Check that all headers compile as C++ Documentation Targets: html Build documentation in multi-page HTML format diff --git a/meson.build b/meson.build index 43894f050e8..7ee900198db 100644 --- a/meson.build +++ b/meson.build @@ -4022,6 +4022,21 @@ add_test_setup('running', +############################################################### +# headerscheck +############################################################### + +headerscheck = files('src/tools/pginclude/headerscheck') +run_target('headerscheck', + command: [headerscheck, meson.project_source_root(), meson.project_build_root()] +) + +run_target('cpluspluscheck', + command: [headerscheck, '--cplusplus', meson.project_source_root(), meson.project_build_root()] +) + + + ############################################################### # Pseudo targets ############################################################### diff --git a/src/tools/pginclude/README b/src/tools/pginclude/README index 944bcb01c64..f7f5ff2c01b 100644 --- a/src/tools/pginclude/README +++ b/src/tools/pginclude/README @@ -62,6 +62,9 @@ have included at least in your configure options, else you're likely to get errors about related headers not being found. +When using meson, run "meson compile -C build headerscheck" or "ninja +-C build headerscheck". + A limitation of the current script is that it doesn't know exactly which headers are for frontend or backend; when in doubt it uses postgres.h as prerequisite, even if postgres_fe.h or c.h would be more appropriate. @@ -89,6 +92,9 @@ have included at least in your configure options, else you're likely to get errors about related headers not being found. +When using meson, run "meson compile -C build cpluspluscheck" or +"ninja -C build cpluspluscheck". + If you are using a non-g++-compatible C++ compiler, you may need to override the script's CXXFLAGS setting by setting a suitable environment value.