Skip to content

build: align local compile flags with dpkg-buildpackage - #1727

Draft
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:build/enable-wall-for-local-build
Draft

Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:build/enable-wall-for-local-build

Conversation

@Ivy233

@Ivy233 Ivy233 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Enable the same warning flags as dpkg-buildpackage for C and C++ targets so that a plain cmake -Bbuild && cmake --build build reports the same warnings/errors as the package build. debian/rules already appends -Wall (DEB_CXXFLAGS_MAINT_APPEND) and hardening=+all adds -Wformat -Werror=format-security; mirror those locally alongside the existing -Werror so warnings that would only fail the dpkg build are caught during local development.

Log: align local cmake compile flags with dpkg-buildpackage

PMS: TASK-394335

Summary by Sourcery

Align local CMake compiler checks with dpkg-buildpackage to catch packaging-build warnings during development.

Enhancements:

  • Align local C and C++ compiler diagnostics with Debian package builds by enabling the same warning and format-security checks.

Build:

  • Apply Debian-equivalent warning flags to CMake builds so locally compiled code reports package-build issues consistently.

Enable the same warning flags as dpkg-buildpackage for C and C++
targets so that a plain `cmake -Bbuild && cmake --build build` reports
the same warnings/errors as the package build. debian/rules already
appends -Wall (DEB_CXXFLAGS_MAINT_APPEND) and hardening=+all adds
-Wformat -Werror=format-security; mirror those locally alongside the
existing -Werror so warnings that would only fail the dpkg build are
caught during local development.

Log: align local cmake compile flags with dpkg-buildpackage

PMS: TASK-394335
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ivy233

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

CMake now applies the Debian-aligned -Wall, -Wformat, and -Werror=format-security flags to C and C++ targets, ensuring local builds surface the same format-related warnings and errors as dpkg-buildpackage.

File-Level Changes

Change Details Files
Align local CMake warning and error flags with the Debian package build for both C and C++ compilation.
  • Enable -Wall for C and C++ targets.
  • Enable format warnings and treat format-security warnings as errors.
  • Retain the existing -Werror setting.
CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更为 CMakeLists.txt 构建配置调整,新增 3 个编译器警告标志(-Wall、-Wformat、-Werror=format-security),使本地构建与 dpkg-buildpackage 包构建产生相同的警告/错误。变更目的明确,语法正确,逻辑清晰,且实际增强了代码安全性。未发现安全漏洞,未引入性能问题,代码质量良好。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['微小建议:4 行 add_compile_options 可合并为单次调用以减少重复,但当前方式可读性良好且与现有代码风格一致,非必须修改']


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: ['本次新增的 -Wformat 和 -Werror=format-security 标志实际上增强了代码安全性,可在编译阶段捕获格式字符串漏洞']


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

Comment thread CMakeLists.txt
@Ivy233
Ivy233 marked this pull request as draft September 9, 2026 07:56
@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.54
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1733

@deepin-bot

deepin-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.55
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1752

@deepin-bot

deepin-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.56
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1753

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.

3 participants