Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3eae0cb

Browse files
committed
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 81b9f23, 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
1 parent 75ca8c1 commit 3eae0cb

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/tools/pginclude/cpluspluscheck

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ tmp=`mktemp -d /tmp/$me.XXXXXX`
5252

5353
trap 'rm -rf $tmp' 0 1 2 3 15
5454

55+
exit_status=0
56+
5557
# Scan all of src/ and contrib/ for header files.
5658
for f in `cd "$srcdir" && find src contrib -name '*.h' -print`
5759
do
@@ -167,9 +169,13 @@ do
167169
esac
168170

169171
# Run the test.
170-
${CXX:-g++} -I $builddir -I $srcdir \
172+
if ! ${CXX:-g++} -I $builddir -I $srcdir \
171173
-I $builddir/src/include -I $srcdir/src/include \
172174
-I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
173175
$EXTRAINCLUDES $EXTRAFLAGS $CXXFLAGS -c $tmp/test.cpp
174-
176+
then
177+
exit_status=1
178+
fi
175179
done
180+
181+
exit $exit_status

src/tools/pginclude/headerscheck

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ tmp=`mktemp -d /tmp/$me.XXXXXX`
4848

4949
trap 'rm -rf $tmp' 0 1 2 3 15
5050

51+
exit_status=0
52+
5153
# Scan all of src/ and contrib/ for header files.
5254
for f in `cd "$srcdir" && find src contrib -name '*.h' -print`
5355
do
@@ -150,9 +152,13 @@ do
150152
esac
151153

152154
# Run the test.
153-
${CC:-gcc} $CPPFLAGS $CFLAGS -I $builddir -I $srcdir \
155+
if ! ${CC:-gcc} $CPPFLAGS $CFLAGS -I $builddir -I $srcdir \
154156
-I $builddir/src/include -I $srcdir/src/include \
155157
-I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
156158
$EXTRAINCLUDES $EXTRAFLAGS -c $tmp/test.c -o $tmp/test.o
157-
159+
then
160+
exit_status=1
161+
fi
158162
done
163+
164+
exit $exit_status

0 commit comments

Comments
 (0)