From 2b3d52a7d07a6993d7b1ba87eb753d1ea412223d Mon Sep 17 00:00:00 2001 From: SysError99 Date: Tue, 29 Aug 2023 02:47:33 +0700 Subject: [PATCH] [3.x] Don't warn about `RETURN_VALUE_DISCARDED` by default --- doc/classes/ProjectSettings.xml | 2 +- modules/gdscript/gdscript.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index b1f26cec660..be88ad66798 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -362,7 +362,7 @@ If [code]true[/code], enables warnings when using a property as if it was a function. - + 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. diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index bde5cb1deaa..7900da25368 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2134,7 +2134,7 @@ GDScriptLanguage::GDScriptLanguage() { GLOBAL_DEF("debug/gdscript/completion/autocomplete_setters_and_getters", false); for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) { 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); } #endif // DEBUG_ENABLED