Merge pull request #81089 from SysError99/3.x-dont-warm-about-return-value-discarded

[3.x] GDScript: Don't warn about `RETURN_VALUE_DISCARDED` by default
This commit is contained in:
lawnjelly 2024-04-04 13:02:22 +01:00 committed by GitHub
commit 75cadbabcb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -369,7 +369,7 @@
<member name="debug/gdscript/warnings/property_used_as_function" type="bool" setter="" getter="" default="true"> <member name="debug/gdscript/warnings/property_used_as_function" type="bool" setter="" getter="" default="true">
If [code]true[/code], enables warnings when using a property as if it was a function. If [code]true[/code], enables warnings when using a property as if it was a function.
</member> </member>
<member name="debug/gdscript/warnings/return_value_discarded" type="bool" setter="" getter="" default="true"> <member name="debug/gdscript/warnings/return_value_discarded" type="bool" setter="" getter="" default="false">
If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum. If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum.
</member> </member>
<member name="debug/gdscript/warnings/shadowed_variable" type="bool" setter="" getter="" default="true"> <member name="debug/gdscript/warnings/shadowed_variable" type="bool" setter="" getter="" default="true">

View file

@ -2149,7 +2149,7 @@ GDScriptLanguage::GDScriptLanguage() {
GLOBAL_DEF("debug/gdscript/completion/autocomplete_setters_and_getters", false); GLOBAL_DEF("debug/gdscript/completion/autocomplete_setters_and_getters", false);
for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) { for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) {
String warning = GDScriptWarning::get_name_from_code((GDScriptWarning::Code)i).to_lower(); String warning = GDScriptWarning::get_name_from_code((GDScriptWarning::Code)i).to_lower();
bool default_enabled = !warning.begins_with("unsafe_") && i != GDScriptWarning::UNUSED_CLASS_VARIABLE; bool default_enabled = !warning.begins_with("unsafe_") && i != GDScriptWarning::UNUSED_CLASS_VARIABLE && i != GDScriptWarning::RETURN_VALUE_DISCARDED;
GLOBAL_DEF("debug/gdscript/warnings/" + warning, default_enabled); GLOBAL_DEF("debug/gdscript/warnings/" + warning, default_enabled);
} }
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED