Skip to content

ci: add Clang compilation warning check to build workflow#1386

Open
messere1 wants to merge 2 commits into
IvorySQL:masterfrom
messere1:ci/issue-1221-clang-warning-check
Open

ci: add Clang compilation warning check to build workflow#1386
messere1 wants to merge 2 commits into
IvorySQL:masterfrom
messere1:ci/issue-1221-clang-warning-check

Conversation

@messere1

@messere1 messere1 commented Jul 9, 2026

Copy link
Copy Markdown

Related Issue

Closes #1221

Motivation

Issue #1221 requests adding a Clang compilation warning check to the CI workflow, mirroring the GCC-side mechanism introduced in #999. Currently .github/workflows/build.yml only builds with GCC 14 and GCC-specific -Werror flags. This PR adds a parallel Clang build job for compiler-diversity warning coverage.

Changes

Add a new build-clang job to .github/workflows/build.yml that:

  • Installs clang (ubuntu-latest default version) alongside the existing build dependencies.
  • Runs ./configure with CC=clang and the same feature flags as the GCC job.
  • Runs make with a set of Clang-supported -Werror warning flags.

The flag list intentionally omits GCC-only flags (-Wshadow=compatible-local, -Werror=missing-variable-declarations) that Clang does not support, and instead includes Clang-equivalent diagnostics that catch the same classes of bugs (unused values/variables, missing prototypes, implicit declarations, type mismatches, format strings, etc.).

The new job runs in parallel with the existing build (GCC) job, so it does not increase overall CI latency.

How Verified

  • YAML lint: no syntax errors in the workflow file.
  • The job structure mirrors the existing proven GCC job (same runner, dependencies, configure flags), only swapping CC=clang and the warning flag set.
  • The fork's Actions run (linked below once available) will provide full validation.

Summary by CodeRabbit

  • Chores
    • Added an additional Clang-based build job to the CI pipeline for stricter compiler checking.
    • The new build uses the existing configuration while treating more warnings as errors to help catch issues earlier, without changing release behavior.

Add a new 'build-clang' job to .github/workflows/build.yml that mirrors
the existing GCC warning-check job but builds with CC=clang and a set of
Clang-supported -Werror warning flags.  This mirrors the GCC-side
mechanism introduced in IvorySQL#999 for parity, as requested in issue IvorySQL#1221.

The new job runs in parallel with the existing GCC build job so it does
not increase overall CI latency.

Closes IvorySQL#1221.
Copilot AI review requested due to automatic review settings July 9, 2026 09:04
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca2eba97-58bc-4831-9466-90e2d5561c8d

📥 Commits

Reviewing files that changed from the base of the PR and between 9f5f162 and 7ff3487.

📒 Files selected for processing (1)
  • .github/workflows/build.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yml

📝 Walkthrough

Walkthrough

Adds a build-clang GitHub Actions job that installs clang, configures the project with existing feature flags, and compiles using clang-specific strict warning checks.

Changes

Clang CI Build

Layer / File(s) Summary
Add build-clang CI job
.github/workflows/build.yml
The new job installs clang and build dependencies, runs configure with CC=clang and existing options, then compiles with stricter -Werror flags covering additional clang diagnostics.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main CI change: adding a Clang compilation warning check to the build workflow.
Linked Issues check ✅ Passed The PR adds a Clang build job with Clang-compatible warning flags, matching issue #1221's request for CI warning coverage.
Out of Scope Changes check ✅ Passed The changes stay focused on the Clang workflow job and related compiler flags/version pinning, with no unrelated scope visible.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI build workflow to add a parallel Clang build job, intended to provide compiler-diversity warning coverage alongside the existing GCC-based build and -Werror checks.

Changes:

  • Added a new build-clang job to run ./configure with CC=clang and compile with a Clang-oriented -Werror flag set.
  • Extended workflow dependencies installation to include clang for the new job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build.yml Outdated
--with-ossp-uuid --with-libxml --with-libxslt --with-perl \
--with-icu --with-libnuma --enable-injection-points --enable-nls
- name: compile
run: make CFLAGS="$CFLAGS -Werror=unused-value -Werror=unused-but-set-variable -Werror=missing-prototypes -Werror=unused-variable -Werror=maybe-uninitialized -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=incompatible-pointer-types -Werror=format -Werror=empty-body -Werror=parentheses -Werror=pointer-sign -Werror=unsequenced"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: dependancy - linux

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/build.yml (2)

59-59: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider setting CXX=clang++ alongside CC=clang

While PostgreSQL is primarily C, explicitly setting CXX=clang++ ensures any C++ components or extensions are also compiled with Clang, maintaining compiler consistency across the build.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml at line 59, The build workflow currently sets
only CC=clang in the configure step, so C++ compilation may still use a
different default compiler. Update the configure invocation in the build
workflow to set CXX=clang++ alongside CC=clang, keeping compiler selection
consistent for any C++ components or extensions referenced by the
configure/build process.

50-51: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider pinning the Clang version for reproducibility

The GCC job pins gcc-14/g++-14 and sets up alternatives, but the Clang job installs the unversioned clang package. As the ubuntu-latest image updates, the Clang version may change, potentially introducing new warnings or behavioral shifts. Consider installing a specific version (e.g., clang-18) for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml around lines 50 - 51, The Clang setup in the
build workflow is unpinned, so the version can drift on ubuntu-latest. Update
the Clang installation in the workflow job that installs build tools to use a
specific version package (for example, a versioned clang package) and make sure
the same version is used consistently in the Clang job alongside the existing
GCC pinning approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build.yml:
- Line 66: The clang build configuration in the build workflow is using the
GCC-only warning group -Werror=maybe-uninitialized, which causes an
unknown-warning diagnostic under clang. Update the CFLAGS definition in the
workflow job so the clang path does not include this flag, and use the
clang-compatible equivalent warning option (or omit it entirely) while keeping
the rest of the compiler warnings unchanged.

---

Nitpick comments:
In @.github/workflows/build.yml:
- Line 59: The build workflow currently sets only CC=clang in the configure
step, so C++ compilation may still use a different default compiler. Update the
configure invocation in the build workflow to set CXX=clang++ alongside
CC=clang, keeping compiler selection consistent for any C++ components or
extensions referenced by the configure/build process.
- Around line 50-51: The Clang setup in the build workflow is unpinned, so the
version can drift on ubuntu-latest. Update the Clang installation in the
workflow job that installs build tools to use a specific version package (for
example, a versioned clang package) and make sure the same version is used
consistently in the Clang job alongside the existing GCC pinning approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 54dadd95-5cef-4aee-98a2-c75dca3ca981

📥 Commits

Reviewing files that changed from the base of the PR and between 7fb2571 and 9f5f162.

📒 Files selected for processing (1)
  • .github/workflows/build.yml

Comment thread .github/workflows/build.yml Outdated
@bigplaice

Copy link
Copy Markdown
Collaborator

Thanks for your patch!

Per review feedback on PR IvorySQL#1386:

- Replace GCC-only -Werror=maybe-uninitialized with Clang's
  -Werror=uninitialized (which enables -Wsometimes-uninitialized)
- Pass CXX=clang++ to configure so C++ compilation also uses Clang
- Pin the Clang version to clang-18 via update-alternatives, mirroring
  how the GCC job pins gcc-14, to avoid toolchain drift on
  ubuntu-latest

Assisted-by: Claude Code:claude-fable-5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Add a Clang compilation warning check in the workflow.

4 participants