From 0a0f45ce79907a0e967563ce7dc529429b604f4e Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 18 Aug 2024 23:28:10 +1200
Subject: [PATCH 1/2] ci: Fix cpluspluscheck failure due to LLVM warnings.

The virtual machine image used to run CompilerWarnings task now has two
versions of LLVM installed.  While configure is running with
LLVM_CONFIG="llvm-config-16", cpluspluscheck was not smart enough to add
it to the include search path, so it was finding LLVM 14's headers in
/usr/include.  Fix that.

The warnings come from LLVM 14 headers, and are suppressed in normal
building (see commit a56e7b66), but that didn't affect cpluspluscheck.
An alternative fix might be to add the warning suppression, but then it
doesn't really make sense for cplusplus check to be seeing different
headers than the other build tasks.

(Note that a proposed change would remove the warning-generating code,
and we could then remove the warning suppression from commit a56e7b66
too, see commitfest submission #4920.)
---
 src/tools/pginclude/headerscheck | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 436e2b92a3..5953e9d6bf 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -49,6 +49,7 @@ CXX=`sed -n 's/^CXX[ 	]*=[ 	]*//p' "$MGLOB"`
 PG_SYSROOT=`sed -n 's/^PG_SYSROOT[ 	]*=[ 	]*//p' "$MGLOB"`
 perl_includespec=`sed -n 's/^perl_includespec[ 	]*=[ 	]*//p' "$MGLOB"`
 python_includespec=`sed -n 's/^python_includespec[ 	]*=[ 	]*//p' "$MGLOB"`
+llvm_includespec=`sed -n 's/^LLVM_CPPFLAGS[ 	]*=[ 	]*//p' "$MGLOB"`
 
 # needed on Darwin
 CPPFLAGS=`echo "$CPPFLAGS" | sed "s|\\\$(PG_SYSROOT)|$PG_SYSROOT|g"`
@@ -235,6 +236,8 @@ do
 		EXTRAINCLUDES="-I $builddir/src/backend/parser/" ;;
 	    src/backend/utils/adt/*)
 		EXTRAINCLUDES="-I $builddir/src/backend/utils/adt/" ;;
+	    src/include/jit/*)
+		EXTRAINCLUDES="$llvm_includespec" ;;
 	    *)
 		EXTRAINCLUDES="" ;;
 	esac
-- 
2.39.2

