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' => '未引用的标签', ]; }