summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-15 00:07:11 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-15 00:07:11 -0300
commita0dd0b616a9b02336de442d522742188786bd98d (patch)
treee99da8d8715dddd730a13bfdadb2650c3947e54b
parentfe8496cb6e24f43bde943190092aad89626771db (diff)
csharp: Suppress CA2000 in native wrappers.
Summary: These methods may instantiate `IDisposable` classes like `Array`, `Iterator` to pass to user-overriden C# methods. As we can't guarantee the user stored the object or not, we can't call Dispose directly on them. Ref T8423 Depends on D10670 Reviewers: brunobelo, felipealmeida, YOhoho Reviewed By: brunobelo Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8423 Differential Revision: https://phab.enlightenment.org/D10671
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh3
-rw-r--r--src/bin/eolian_mono/eolian_mono.cc3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 51bb17c3a1..cded973d23 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -123,7 +123,8 @@ struct native_function_definition_generator
123 self = ""; 123 self = "";
124 124
125 if(!as_generator 125 if(!as_generator
126 (indent << "private static " 126 (indent << "[SuppressMessage(\"Microsoft.Reliability\", \"CA2000:DisposeObjectsBeforeLosingScope\", Justification = \"The instantiated objects can be stored in the called Managed API method.\")]\n"
127 << indent << "private static "
127 << eolian_mono::marshall_type(true) << " " 128 << eolian_mono::marshall_type(true) << " "
128 << string 129 << string
129 << "(System.IntPtr obj, System.IntPtr pd" 130 << "(System.IntPtr obj, System.IntPtr pd"
diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc
index fd40e9982d..62eed11b2a 100644
--- a/src/bin/eolian_mono/eolian_mono.cc
+++ b/src/bin/eolian_mono/eolian_mono.cc
@@ -171,7 +171,8 @@ run(options_type const& opts)
171 "using System.Collections.Generic;\n" 171 "using System.Collections.Generic;\n"
172 "using System.Linq;\n" 172 "using System.Linq;\n"
173 "using System.Threading;\n" 173 "using System.Threading;\n"
174 "using System.ComponentModel;\n") 174 "using System.ComponentModel;\n"
175 "using System.Diagnostics.CodeAnalysis;\n")
175 .generate(iterator, efl::eolian::grammar::attributes::unused, efl::eolian::grammar::context_null())) 176 .generate(iterator, efl::eolian::grammar::attributes::unused, efl::eolian::grammar::context_null()))
176 { 177 {
177 throw std::runtime_error("Failed to generate file preamble"); 178 throw std::runtime_error("Failed to generate file preamble");