From e845414c3685fdb407bfe439baaca80158751fd1 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 23 Sep 2026 06:18:05 -0500 Subject: [PATCH 1/2] BUG: Pass a void pointer to %p in the CIFTI NULL-input message %p takes a pointer to void. fname was passed as const char *, while its two siblings on the same line were already cast, so the mismatch was a single argument. Clang reports it under -Wformat-pedantic. (cherry picked from commit 7fa06d7bb4c5b9c76f1066c33c790738d22be560) (cherry picked from commit f7381a3a99b892b26ab877f06b45ac178f34780f) --- cifti/afni_xml_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cifti/afni_xml_io.c b/cifti/afni_xml_io.c index a59f5c3e..c4513557 100644 --- a/cifti/afni_xml_io.c +++ b/cifti/afni_xml_io.c @@ -45,7 +45,7 @@ int axio_read_cifti_file(const char * fname, int get_ndata, if( !fname || !nim_out || !ax_out ) { fprintf(stderr,"** axio_CIFTI: NULL inputs %p, %p, %p\n", - fname, (void *)nim_out, (void *)ax_out); + (const void *)fname, (void *)nim_out, (void *)ax_out); return 1; } From 1bbf73e440a8475aa141012f0ea5166b01b431c1 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Sat, 15 Aug 2026 00:14:50 -0400 Subject: [PATCH 2/2] COMP: Add CI jobs for clang-tidy and for building with -Werror A new workflow with two jobs, so that the clang-tidy configuration and the shared warning set are exercised rather than merely present. clang-tidy configures with CMAKE_EXPORT_COMPILE_COMMANDS and runs run-clang-tidy. It reports findings without failing; removing the '|| true' is the last step of that work, once the remaining checks are clean. warnings-as-errors a gcc and a clang job, each configuring with NIFTI_WARNINGS_AS_ERRORS=ON, building and testing. The warning sites that once blocked the second job have since been fixed: the sign conversions in the tools, the transposed calloc arguments, and the ambiguous-filename rewrite all landed separately. (cherry picked from commit bb8e9af3a9a291364ab1b5010ef1e61cf25ea332) (cherry picked from commit 5fdc07c77c6afc1b27b92f8595279d79ea34a44a) --- .github/workflows/static-checks.yml | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/static-checks.yml diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml new file mode 100644 index 00000000..79e0186d --- /dev/null +++ b/.github/workflows/static-checks.yml @@ -0,0 +1,61 @@ +name: Static checks + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + clang-tidy: + name: clang-tidy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + cmake ninja-build clang-tidy zlib1g-dev libexpat1-dev + + - name: Configure + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DUSE_CIFTI_CODE=ON -DUSE_FSL_CODE=ON + + # The tree is not yet clean under every enabled check, so this reports + # findings without failing. Drop the "|| true" once it is. + - name: Run clang-tidy + run: run-clang-tidy -p build -j "$(nproc)" -quiet || true + + warnings-as-errors: + name: warnings-as-errors (${{ matrix.cc }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + cc: [gcc, clang] + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + cmake ninja-build zlib1g-dev libexpat1-dev + + - name: Build with -Werror + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=${{ matrix.cc }} \ + -DBUILD_SHARED_LIBS=ON \ + -DUSE_CIFTI_CODE=ON -DUSE_FSL_CODE=ON \ + -DNIFTI_WARNINGS_AS_ERRORS=ON + cmake --build build -j "$(nproc)" + + - name: Test + run: ctest --test-dir build --output-on-failure