aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2022-08-16 10:53:29 +1200
committerThomas Munro <tmunro@postgresql.org>2022-08-16 10:53:29 +1200
commit3eae0cbf7e70db885c4ec37e0863022d3ad589d4 (patch)
treefbd43c57fd5d83739fb9b64ab3f2a8f50937069f
parent75ca8c14576238926e1f4c2e80c11dd23a1911c3 (diff)
downloadpostgresql-3eae0cbf7e70db885c4ec37e0863022d3ad589d4.tar.gz
postgresql-3eae0cbf7e70db885c4ec37e0863022d3ad589d4.zip
Fix headerscheck and cpluspluscheck's exit codes.
For the benefit of CI, which started running these header check scripts in its CompilerWarnings task in commit 81b9f23c9c8, they should report failure if any individual header failed to compile. Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA%2BhUKGKtDwPo9wzKgbStDwfOhEpywMc6PQofio8fAHR7yUjgxw%40mail.gmail.com
-rwxr-xr-xsrc/tools/pginclude/cpluspluscheck10
-rwxr-xr-xsrc/tools/pginclude/headerscheck10
2 files changed, 16 insertions, 4 deletions
diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck
index eb06ee01111..2d3b785342f 100755
--- a/src/tools/pginclude/cpluspluscheck
+++ b/src/tools/pginclude/cpluspluscheck
@@ -52,6 +52,8 @@ tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 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
@@ -167,9 +169,13 @@ do
esac
# Run the test.
- ${CXX:-g++} -I $builddir -I $srcdir \
+ if ! ${CXX:-g++} -I $builddir -I $srcdir \
-I $builddir/src/include -I $srcdir/src/include \
-I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
$EXTRAINCLUDES $EXTRAFLAGS $CXXFLAGS -c $tmp/test.cpp
-
+ then
+ exit_status=1
+ fi
done
+
+exit $exit_status
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 3f8640a03dd..b8419e46a49 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -48,6 +48,8 @@ tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 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
@@ -150,9 +152,13 @@ do
esac
# Run the test.
- ${CC:-gcc} $CPPFLAGS $CFLAGS -I $builddir -I $srcdir \
+ if ! ${CC:-gcc} $CPPFLAGS $CFLAGS -I $builddir -I $srcdir \
-I $builddir/src/include -I $srcdir/src/include \
-I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
$EXTRAINCLUDES $EXTRAFLAGS -c $tmp/test.c -o $tmp/test.o
-
+ then
+ exit_status=1
+ fi
done
+
+exit $exit_status