Closed
[Bug-Report|缺陷反馈]:编译告警清理 #9053
yijiliangAdd on  4 days agoClosed at  4 days ago
yijiliang
yijiliangCollaborators
4 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

库上部分代码未遵守编写规范,存在部分编译告警

Environment Information / 环境信息 (Mandatory / 必填)

Ascend950

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

编译即可

Describe the expected behavior / 预期结果 (Mandatory / 必填)

无编译告警

无

Special notes for this issue/备注 (Optional / 选填)

likedislike
yijiliangyijiliangCollaborators
4 days ago Added label: bug-report
yuning_chen
yuning_chenCollaborators
4 days ago Comments:

收到,编译告警清理。有几点建议,避免这单变成「改完又长回来」:

  1. 先给告警基线:贴出当前告警总数与分类(-Wunused / -Wsign-compare / 隐式窄化 / -Wshadow 等各多少条),修复后给同口径对比。没有数字的话无法判断「清理完了」。
  2. 优先清「会掩盖真问题」的那几类:隐式窄化(-Wconversion)、未初始化、格式化字符串不匹配——这几类是真的 bug 温床;纯风格类(未使用变量、shadow)可以第二批。
  3. -Werror 要谨慎开:全仓一次开 -Werror 风险很大(编译器版本差异会让不同环境的告警集合不同)。建议先按目录/模块逐步开,或只对新增代码开。
  4. 别引入「静默屏蔽」:清理时避免用 (void)x 硬吞、#pragma GCC diagnostic ignored 局部压制这类手段,除非注释写清为什么。否则等于把告警变成了注释。
  5. 告警在 CI 里要有增量门禁:只卡「本次 PR 不新增告警」即可,避免存量告警阻塞所有 PR。
likedislike
yuning_chenyuning_chenCollaborators
4 days ago Assign yijiliang as responsible person
yuning_chen
yuning_chenCollaborators
4 days ago Comments:

您好,问题已收到,当前 @yijiliang 正在处理中。

likedislike
CANN-robotCANN-robotCollaborators
4 days ago Close issue
CANN-robotCANN-robotCollaborators
4 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
3 days ago Added label: resolved