1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-10-23 21:28:56 +03:00

Rename the unity job to lint and widen what it checks.

Unity is how two of the checks are built rather than what any of them look for, and the job had already grown a check that does not need a unity build at all. lint describes the whole set and pairs with the code-format job below it.

Drop debug from the unused parameter build. Asserts are compiled out of a release build, so a parameter that only an assert reads is reported along with a parameter that nothing reads at all. Both are marked the same way, with a void cast that shows ignoring the parameter is intended.

Add libssh2 so the SFTP driver is built. Without it HAVE_LIBSSH2 is undefined and the driver is preprocessed away, so none of these checks were looking at it.
This commit is contained in:
David Steele
2026-08-20 16:35:57 +07:00
parent 8ab8411d7a
commit db7dfffbb4

View File

@@ -9,8 +9,8 @@ permissions:
contents: read
jobs:
# Run meson unity build to check for errors, unused functions, unused parameters, and externed functions
unity:
# Run meson builds to check for errors, unused functions, unused parameters, and externed functions
lint:
runs-on: ubuntu-24.04
steps:
@@ -25,14 +25,14 @@ jobs:
- name: Install
run: |
DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zlib1g-dev libssl-dev \
libxml2-dev libpq-dev pkg-config meson liblz4-dev libzstd-dev libbz2-dev
libxml2-dev libpq-dev pkg-config meson liblz4-dev libzstd-dev libbz2-dev libssh2-1-dev
- name: Build
run: |
meson setup --unity=on -Dwerror=true build ${GITHUB_WORKSPACE?}/pgbackrest
ninja -vC build
# Check that the unity build leaves main as the only symbol. FN_EXTERN and friends are defined as static for the unity
# Check that a unity build leaves main as the only symbol. FN_EXTERN and friends are defined as static for the unity
# build, so any other symbol is a function or variable that escaped that treatment. The object is checked rather than the
# linked binary because the binary also has whatever the C runtime, the static libbacktrace archive, and the copy
# relocations for shared library variables put there, none of which is what is being tested and all of which vary by
@@ -45,9 +45,9 @@ jobs:
# Check for unused parameters. The FUNCTION_LOG_PARAM*() macros reference each parameter they log, which counts as a use and
# hides parameters the function never touches, so append overrides to debug.h that compile the macros out. Nothing is lost
# by that here since this build is never run. Debug is enabled because a release build compiles out asserts, which would
# report parameters used only by an assert, and unused function warnings are disabled because the *ToLog() functions have
# nothing left to call them once the parameter macros are gone.
# by that here since this build is never run. Asserts are compiled out of a release build as well, so a parameter that
# only an assert reads is reported too and must be marked with a void cast to show that ignoring it is intended. Unused
# function warnings are disabled because the *ToLog() functions have nothing left to call them once the macros are gone.
- name: Check Unused Parameter
run: |
cat >> ${GITHUB_WORKSPACE?}/pgbackrest/src/common/debug.h <<'EOF'
@@ -62,7 +62,7 @@ jobs:
#define FUNCTION_LOG_PARAM_PP(typeMacroPrefix, param)
EOF
meson setup --unity=on -Ddebug=true -Dwerror=true -Dc_args=-Wno-unused-function build-unused-param \
meson setup --unity=on -Dwerror=true -Dc_args=-Wno-unused-function build-unused-param \
${GITHUB_WORKSPACE?}/pgbackrest
ninja -vC build-unused-param