CI cpluspluscheck failures

Started by Thomas Munroover 1 year ago3 messages
#1Thomas Munro
thomas.munro@gmail.com
2 attachment(s)

Hi,

The CompilerWarnings cspluspluscheck started failing recently.

1. LLVM library version issue. See commit message for details.
2. pg_verify_backup.h now uses simplehash.h, which references
pg_fatal(), which nobody declared.

I'm not sure why the first one started happening at the commit
(aa2d6b15) that caused the second one, I feel like I'm missing
something...

https://github.com/postgres/postgres/commits/master/

Anyway, these patches turn it green for me. Please see attached.

https://cirrus-ci.com/task/5014011601747968

Attachments:

0001-ci-Fix-cpluspluscheck-failure-due-to-LLVM-warnings.patchtext/x-patch; charset=US-ASCII; name=0001-ci-Fix-cpluspluscheck-failure-due-to-LLVM-warnings.patchDownload
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

0002-ci-Placate-cpluspluscheck-about-pg_verifybackup.h.patchtext/x-patch; charset=US-ASCII; name=0002-ci-Placate-cpluspluscheck-about-pg_verifybackup.h.patchDownload
From 359461690fd89e79e67e649f1dac7e8898fd3dd2 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 18 Aug 2024 23:56:11 +1200
Subject: [PATCH 2/2] ci: Placate cpluspluscheck about pg_verifybackup.h.

simplehash.h references pg_fatal(), which cpluspluscheck says is
undeclared.
---
 src/bin/pg_verifybackup/pg_verifybackup.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/pg_verifybackup/pg_verifybackup.h b/src/bin/pg_verifybackup/pg_verifybackup.h
index c395217788..d8c566ed58 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.h
+++ b/src/bin/pg_verifybackup/pg_verifybackup.h
@@ -16,6 +16,7 @@
 
 #include "common/controldata_utils.h"
 #include "common/hashfn_unstable.h"
+#include "common/logging.h"
 #include "common/parse_manifest.h"
 #include "fe_utils/simple_list.h"
 
-- 
2.39.2

#2Thomas Munro
thomas.munro@gmail.com
In reply to: Thomas Munro (#1)
Re: CI cpluspluscheck failures

On Mon, Aug 19, 2024 at 12:10 AM Thomas Munro <thomas.munro@gmail.com> wrote:

I'm not sure why the first one started happening at the commit
(aa2d6b15) that caused the second one, I feel like I'm missing
something...

What I was missing is that the LLVM warnings were already present, but
not causing failures because they are "system" headers. So I'll go
and push the fix for aa2d6b15, and wait longer for comment on the LLVM
one which has been wrong, but green, for a while.

#3Amul Sul
sulamul@gmail.com
In reply to: Thomas Munro (#2)
1 attachment(s)
Re: CI cpluspluscheck failures

On Mon, Aug 19, 2024 at 1:30 AM Thomas Munro <thomas.munro@gmail.com> wrote:

On Mon, Aug 19, 2024 at 12:10 AM Thomas Munro <thomas.munro@gmail.com> wrote:

I'm not sure why the first one started happening at the commit
(aa2d6b15) that caused the second one, I feel like I'm missing
something...

Thanks, Thomas, for addressing the missing include.

Adding logging.h to the pg_verifybackup.h file makes it redundant in
pg_verifybackup.c. The attached patch proposes removing this redundant
include from pg_verifybackup.c, along with a few other unnecessary
includes.

Regards,
Amul

Attachments:

0001-Remove-unnecessary-include-statements.patchapplication/x-patch; name=0001-Remove-unnecessary-include-statements.patchDownload
From 33ccca65daacb44cfb526bdabcd3a3d9c06443f1 Mon Sep 17 00:00:00 2001
From: Amul Sul <amul.sul@enterprisedb.com>
Date: Tue, 20 Aug 2024 09:44:56 +0530
Subject: [PATCH] Remove unnecessary #include statements.

---
 src/bin/pg_verifybackup/pg_verifybackup.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index 3fcfb167217..2a461079a38 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <time.h>
 
-#include "common/logging.h"
-#include "common/parse_manifest.h"
-#include "fe_utils/simple_list.h"
 #include "getopt_long.h"
 #include "pg_verifybackup.h"
 #include "pgtime.h"
-- 
2.18.0