Commit 486bdeff authored by one's avatar one
Browse files

Add dcc-void-return

parent 24e48648
# dcc 对 `void` 函数误报 `-Wreturn-type`
## 复现方式
镜像:
```text
harbor.sourcefind.cn:5443/dcu/admin/base/pytorch:2.7.1-ubuntu22.04-dtk26.04-py3.11
```
在容器内执行:
```sh
dcc -std=c++17 -Werror=return-type -c void-return.cpp -o void-return.o
```
## 实际结果
DTK 26.04 的 `dcc` 会报错:
```text
void-return.cpp:1:11: error: void function is missing a return statement [-Werror,-Wreturn-type]
void f() {}
^
```
## 预期结果
这段源码应该能够正常编译。`void f() {}` 是合法的 C++ 代码,`-Wreturn-type` 不应该仅仅因为 `void` 函数没有显式写出 `return;` 就给出诊断。
当项目启用 `-Werror=return-type` 时,这个问题也会影响更大的构建;普通的空 `void` 函数会在 `dcc` 下变成硬错误。
void f() {}
int main()
{
f();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment