diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-07 16:09:53 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-07 16:09:53 +0200 |
commit | 0384abe9ca47f65679eff55377faefc810733361 (patch) | |
tree | 8d6db41ffdc821e18f992861461f9425009c518f | |
parent | c723125dfcc1ffee76e6a9a415b393606a3c5218 (diff) | |
parent | 62b066dbd62e98c78e16769d4203d31b42e1d26e (diff) |
Merge pull request #67027 from akien-mga/msvc-fix-c4702
Fix more MSVC C4702 (unreachable code) warnings
-rw-r--r-- | core/variant/variant.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/tests/gdscript_test_runner.cpp | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index fbce337359..4eae23b0fb 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1929,8 +1929,6 @@ String Variant::stringify(int recursion_count) const { return "<" + get_type_name(type) + ">"; } } - - return ""; } String Variant::to_json_string() const { diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index 6c346acb7e..15131afde7 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -479,9 +479,9 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { result.output = get_text_for_status(result.status) + "\n"; const List<GDScriptParser::ParserError> &errors = parser.get_errors(); - for (const GDScriptParser::ParserError &E : errors) { - result.output += E.message + "\n"; // TODO: line, column? - break; // Only the first error since the following might be cascading. + if (!errors.is_empty()) { + // Only the first error since the following might be cascading. + result.output += errors[0].message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); @@ -498,9 +498,9 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { result.output = get_text_for_status(result.status) + "\n"; const List<GDScriptParser::ParserError> &errors = parser.get_errors(); - for (const GDScriptParser::ParserError &E : errors) { - result.output += E.message + "\n"; // TODO: line, column? - break; // Only the first error since the following might be cascading. + if (!errors.is_empty()) { + // Only the first error since the following might be cascading. + result.output += errors[0].message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); |