Re: Combine headerscheck and cpluspluscheck scripts

2024-04-18 Thread Peter Eisentraut

On 16.04.24 17:17, Anton Voloshin wrote:

On 10/03/2024 12:03, Peter Eisentraut wrote:

Committed, thanks.


This commit (7b8e2ae2f) have turned cpluspluscheck script into a 
--cplusplus option for headerscheck.  I propose to update the 
src/tools/pginclude/README correspondingly, please see the attached patch.


Fixed, thanks!





Re: Combine headerscheck and cpluspluscheck scripts

2024-04-16 Thread Anton Voloshin

Hello, hackers,

On 10/03/2024 12:03, Peter Eisentraut wrote:

Committed, thanks.


This commit (7b8e2ae2f) have turned cpluspluscheck script into a 
--cplusplus option for headerscheck.  I propose to update the 
src/tools/pginclude/README correspondingly, please see the attached patch.


--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ruFrom a50e58f117341e8a9df5f97fa05630f7b8f4bd86 Mon Sep 17 00:00:00 2001
From: Anton Voloshin 
Date: Tue, 16 Apr 2024 17:19:28 +0300
Subject: [PATCH] Update src/tools/pginclude/README to match recent changes to
 cpluspluscheck

7b8e2ae2f have turned cpluspluscheck from separate script into
a --cplusplus option for headerscheck. Update README correspondingly.
---
 src/tools/pginclude/README | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/tools/pginclude/README b/src/tools/pginclude/README
index 712eca76fb3..65372057dad 100644
--- a/src/tools/pginclude/README
+++ b/src/tools/pginclude/README
@@ -1,10 +1,10 @@
 src/tools/pginclude/README
 
-NOTE: headerscheck and cpluspluscheck are in current use, and any
-problems they find should generally get fixed.  The other scripts
-in this directory have not been used in some time, and have issues.
-pgrminclude in particular has a history of creating more problems
-than it fixes.  Be very wary of applying their results blindly.
+NOTE: headerscheck and headerscheck --cplusplus are in current use, and any
+problems they find should generally get fixed.  The other scripts in this
+directory have not been used in some time, and have issues.  pgrminclude in
+particular has a history of creating more problems than it fixes.  Be very
+wary of applying their results blindly.
 
 
 pginclude
@@ -84,16 +84,16 @@ prerequisite, even if postgres_fe.h or c.h would be more appropriate.
 Also note that the contents of macros are not checked; this is intentional.
 
 
-cpluspluscheck
-==
+headerscheck --cplusplus
+
 
-This script can be run to verify that all Postgres include files meet
-the project convention that they will compile as C++ code.  Although
-the project's coding language is C, some people write extensions in C++,
-so it's helpful for include files to be C++-clean.
+The headerscheck in --cplusplus mode can be run to verify that all Postgres
+include files meet the project convention that they will compile as C++
+code.  Although the project's coding language is C, some people write
+extensions in C++, so it's helpful for include files to be C++-clean.
 
 A small number of header files are exempted from this requirement,
-and are skipped by the cpluspluscheck script.
+and are skipped by the script in the --cplusplus mode.
 
 The easy way to run the script is to say "make -s cpluspluscheck" in
 the top-level build directory after completing a build.  You should
-- 
2.43.2



Re: Combine headerscheck and cpluspluscheck scripts

2024-03-10 Thread Peter Eisentraut

On 07.03.24 08:30, Michael Paquier wrote:

On Thu, Mar 07, 2024 at 01:37:36PM +1300, Thomas Munro wrote:

+1


Looking at the patch, nice cleanup.


Committed, thanks.





Re: Combine headerscheck and cpluspluscheck scripts

2024-03-06 Thread Michael Paquier
On Thu, Mar 07, 2024 at 01:37:36PM +1300, Thomas Munro wrote:
> +1

Looking at the patch, nice cleanup.
--
Michael


signature.asc
Description: PGP signature


Re: Combine headerscheck and cpluspluscheck scripts

2024-03-06 Thread Thomas Munro
+1




Combine headerscheck and cpluspluscheck scripts

2024-02-07 Thread Peter Eisentraut
headerscheck started in 55ea1091884 (2019) essentially as an adjusted 
copy of cpluspluscheck.  Since then two scripts have not drifted far 
apart.  But there are occasionally mistakes keeping the two exclude 
lists updated together.  I figure we can just combine the two scripts 
into one, so it's easier to keep updated.


The attached patch adds an option --cplusplus to headerscheck, with 
which it does the same thing as cpluspluscheck, and cpluspluscheck is 
removed.  The top-level make targets stay the same.From 097e135bc421af98dc6298510d4cb4d8d778e3fe Mon Sep 17 00:00:00 2001
From: Peter Eisentraut 
Date: Wed, 7 Feb 2024 16:22:07 +0100
Subject: [PATCH] Combine headerscheck and cpluspluscheck scripts

They are mostly the same, and it is tedious to maintain two copies of
essentially the same exclude list.  headerscheck now has a new option
--cplusplus to select the cpluspluscheck functionality.  The top-level
make targets are still the same.
---
 GNUmakefile.in |   2 +-
 src/tools/pginclude/cpluspluscheck | 227 -
 src/tools/pginclude/headerscheck   |  57 +++-
 3 files changed, 54 insertions(+), 232 deletions(-)
 delete mode 100755 src/tools/pginclude/cpluspluscheck

diff --git a/GNUmakefile.in b/GNUmakefile.in
index eba569e930e..4d8fc794bbb 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -133,6 +133,6 @@ headerscheck: submake-generated-headers
$(top_srcdir)/src/tools/pginclude/headerscheck $(top_srcdir) 
$(abs_top_builddir)
 
 cpluspluscheck: submake-generated-headers
-   $(top_srcdir)/src/tools/pginclude/cpluspluscheck $(top_srcdir) 
$(abs_top_builddir)
+   $(top_srcdir)/src/tools/pginclude/headerscheck --cplusplus 
$(top_srcdir) $(abs_top_builddir)
 
 .PHONY: dist distdir distcheck docs install-docs world check-world 
install-world installcheck-world headerscheck cpluspluscheck
diff --git a/src/tools/pginclude/cpluspluscheck 
b/src/tools/pginclude/cpluspluscheck
deleted file mode 100755
index 7edfc44b49a..000
--- a/src/tools/pginclude/cpluspluscheck
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/sh
-
-# Check (almost) all PostgreSQL include files for C++ compatibility.
-#
-# Argument 1 is the top-level source directory, argument 2 the
-# top-level build directory (they might be the same). If not set, they
-# default to the current directory.
-#
-# Needs to be run after configuring and creating all generated headers.
-# It's advisable to configure --with-perl --with-python, else you're
-# likely to get errors from associated headers.
-#
-# No output if everything is OK, else compiler errors.
-#
-# src/tools/pginclude/cpluspluscheck
-# Copyright (c) 2009-2024, PostgreSQL Global Development Group
-
-if [ -z "$1" ]; then
-srcdir="."
-else
-srcdir="$1"
-fi
-
-if [ -z "$2" ]; then
-builddir="."
-else
-builddir="$2"
-fi
-
-me=`basename $0`
-
-# These switches are g++ specific, you may override if necessary.
-CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
-
-# Pull some info from configure's results.
-MGLOB="$builddir/src/Makefile.global"
-CPPFLAGS=`sed -n 's/^CPPFLAGS[ ]*=[]*//p' "$MGLOB"`
-CXX=`sed -n 's/^CXX[   ]*=[]*//p' "$MGLOB"`
-perl_includespec=`sed -n 's/^perl_includespec[ ]*=[]*//p' "$MGLOB"`
-python_includespec=`sed -n 's/^python_includespec[ ]*=[]*//p' "$MGLOB"`
-
-# Extract any -I and -D switches from CPPFLAGS.
-# (If necessary, user can pass more switches by presetting EXTRAFLAGS.)
-for flag in $CPPFLAGS; do
-  case $flag in
--I*|-D*) EXTRAFLAGS="$EXTRAFLAGS $flag";;
-  esac
-done
-
-# Create temp directory.
-tmp=`mktemp -d /tmp/$me.XX`
-
-trap "ret=$?; rm -rf $tmp; exit $ret" 0 1 2 3 15
-
-exit_status=0
-
-# Scan all of src/ and contrib/ for header files.
-for f in `cd "$srcdir" && find src contrib -name '*.h' -print`
-do
-   # Ignore files that are unportable or intentionally not standalone.
-
-   # These files are platform-specific, and c.h will include the
-   # one that's relevant for our current platform anyway.
-   test "$f" = src/include/port/aix.h && continue
-   test "$f" = src/include/port/cygwin.h && continue
-   test "$f" = src/include/port/darwin.h && continue
-   test "$f" = src/include/port/freebsd.h && continue
-   test "$f" = src/include/port/linux.h && continue
-   test "$f" = src/include/port/netbsd.h && continue
-   test "$f" = src/include/port/openbsd.h && continue
-   test "$f" = src/include/port/solaris.h && continue
-   test "$f" = src/include/port/win32.h && continue
-
-   # Additional Windows-specific headers.
-   test "$f" = src/include/port/win32_port.h && contin