`-Wunused-but-set-parameter` is only suppressed in Debug

已关闭 适合新手
#2,079 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
build-system

调研方向

编辑 include/godot_cpp/core/binder_common.hpp:移除 #if defined(DEBUG_ENABLED) 对 #pragma GCC diagnostic push 的 guard,使其与无条件的 pop 匹配。使用 -Wunused-but-set-parameter 和 -Werror 在 Release 中构建 godot-cpp 以确认编译通过。当警告在 Release 中被抑制时完成。

由索引模型根据 Issue 内容生成。

描述

bug
Godot version

4.7.2-stable

godot-cpp version

10.0.0-stable

System information

Windows 11

Issue description

The file in question:
include/godot_cpp/core/binder_common.hpp

The issue is that when godot-cpp is built in Release with GCC with -Wunused-but-set-parameter, this parameter is not suppressed and with -Werror it fails to compile. Also, it seems like an inconsistent check, because #pragma push checks DEBUG_ENABLED, but #pragma pop doesn't.

Suggested fix:
Remove #if defined(DEBUG_ENABLED), so the warning suppression applies in Release too.

// GCC raises "parameter 'p_args' set but not used" when P = {},
// it's not clever enough to treat other P values as making this branch valid.
#if defined(DEBUG_ENABLED) && defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif

...

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
Steps to reproduce

Build godot-cpp in Release with -Wunused-but-set-parameter

Minimal reproduction project

N/A

主要语言
C++
星标
2.8k
派生
825
平均合并
3 天 23 小时
30 天内合并 PR
19

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

godotengine/godot-cpp 的其他 Issue

查看 godotengine/godot-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。