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 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; }