From 67496f6bf6584df09c5f7e75d256d1326d6c8517 Mon Sep 17 00:00:00 2001 From: rango Date: Fri, 8 May 2026 16:12:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(php):=20=E6=B7=BB=E5=8A=A0MSVC=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=99=A8=E8=AD=A6=E5=91=8A=E6=8A=91=E5=88=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在Constants.php中新增未使用的局部变量和未引用标签的警告代码 - 实现MSVC后端对suppressed_warnings选项的支持 - 添加循环遍历警告代码并构建/wd参数的功能 - 集成警告抑制到编译命令中 --- src/Php/Backend/Msvc.php | 7 +++++++ src/Php/Constants.php | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/Php/Backend/Msvc.php b/src/Php/Backend/Msvc.php index 2b04b369..b9df93aa 100644 --- a/src/Php/Backend/Msvc.php +++ b/src/Php/Backend/Msvc.php @@ -113,6 +113,13 @@ class Msvc extends CompilerBackend // 警告级别 $cmd .= ' /W3'; + // 禁用常见警告 + if (!empty($options['suppressed_warnings'])) { + foreach ($options['suppressed_warnings'] as $code => $description) { + $cmd .= " /wd{$code}"; + } + } + // C++ 标准 $cppStd = $options['cpp_std'] ?? 'c++17'; $cmd .= ' /std:' . $cppStd; diff --git a/src/Php/Constants.php b/src/Php/Constants.php index 8752049a..ec52b113 100644 --- a/src/Php/Constants.php +++ b/src/Php/Constants.php @@ -178,5 +178,7 @@ class Constants '5220' => 'volatile 成员警告', '4100' => '未使用的参数', '5039' => '使用未定义的函数', + '4101' => '未使用的局部变量', + '4102' => '未引用的标签', ]; }