42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
|
|
---
|
|||
|
|
id: VDE-028
|
|||
|
|
status: fixed
|
|||
|
|
severity: low
|
|||
|
|
category: code-quality
|
|||
|
|
date: 2026-07-28
|
|||
|
|
reporter: ViewDesign
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# VDE-028: step_export.cpp 误导缩进警告 + 未使用变量
|
|||
|
|
|
|||
|
|
## 描述
|
|||
|
|
在 ViewDesign MSVC 构建中,`vde_brep` 的 `step_export.cpp` 产生多个编译警告:
|
|||
|
|
|
|||
|
|
1. **`-Wmisleading-indentation`** (4处):`write_bspline_surface` 函数中 `if` 语句和后续语句在同一行,误导缩进
|
|||
|
|
- 行 276: `if (i > 0) ss << ","; ss << um[i];`
|
|||
|
|
- 行 280: `if (i > 0) ss << ","; ss << vm[i];`
|
|||
|
|
- 行 284: `if (i > 0) ss << ","; ss << uu[i];`
|
|||
|
|
- 行 288: `if (i > 0) ss << ","; ss << vuu[i];`
|
|||
|
|
|
|||
|
|
2. **`-Wunused-variable`** (1处):行 233 `auto& w = surf.weights();` 声明后未使用
|
|||
|
|
|
|||
|
|
## 复现步骤
|
|||
|
|
```
|
|||
|
|
cmake --build build --config Release --target vde_brep
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 影响
|
|||
|
|
- 仅影响代码整洁度,不影响功能正确性
|
|||
|
|
- 大量警告可能掩盖真正的错误
|
|||
|
|
|
|||
|
|
## 修复建议
|
|||
|
|
1. 误导缩进:将同一行的两个语句拆分为多行带大括号
|
|||
|
|
```cpp
|
|||
|
|
if (i > 0) { ss << ","; }
|
|||
|
|
ss << um[i];
|
|||
|
|
```
|
|||
|
|
2. 未使用变量:删除 `auto& w = surf.weights();`,或添加 `(void)w;`
|
|||
|
|
|
|||
|
|
## 相关文件
|
|||
|
|
- `src/brep/step_export.cpp:233,276,280,284,288`
|