lauromoura pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ee33f93743b41c82543f8857e72e38e60a5cd67f

commit ee33f93743b41c82543f8857e72e38e60a5cd67f
Author: Yeongjong Lee <[email protected]>
Date:   Wed Oct 16 10:39:52 2019 -0300

    mono: make public static field const or readonly
    
    Summary: This patch will fix CA2211 compiler warnings.
    
    Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true
    
    Reviewers: lauromoura, Jaehyun_Cho
    
    Reviewed By: lauromoura
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D10423
---
 .../eolian_mono/eolian/mono/function_definition.hh |  2 +-
 src/bindings/mono/efl_mono/efl_libs.cs.in          | 24 +++++++++++-----------
 src/bindings/mono/eina_mono/eina_array.cs          |  2 +-
 src/bindings/mono/eina_mono/eina_error.cs          | 10 ++++-----
 src/bindings/mono/eina_mono/eina_inarray.cs        |  2 +-
 src/bindings/mono/eina_mono/eina_log.cs            | 24 +++++++++++-----------
 src/bindings/mono/eina_mono/eina_value.cs          |  2 +-
 src/bindings/mono/eldbus_mono/eldbus_common.cs     |  2 +-
 src/bindings/mono/eo_mono/iwrapper.cs              |  8 ++++----
 9 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh 
b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 301f5417f3..d17ac564ea 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -76,7 +76,7 @@ struct native_function_definition_generator
 
     // Delegate holder (so it can't be collected).
     if(!as_generator
-       (indent << "public static Efl.Eo.FunctionWrapper<" << string << 
"_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
+       (indent << "public static readonly Efl.Eo.FunctionWrapper<" << string 
<< "_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
           << string << "_api_delegate>(Module, \"" << string << "\");\n\n")
        .generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name, 
f.c_name), context))
       return false;
diff --git a/src/bindings/mono/efl_mono/efl_libs.cs.in 
b/src/bindings/mono/efl_mono/efl_libs.cs.in
index 0aa56908ff..87aee83a1e 100644
--- a/src/bindings/mono/efl_mono/efl_libs.cs.in
+++ b/src/bindings/mono/efl_mono/efl_libs.cs.in
@@ -21,18 +21,18 @@ public class Libs {
     public const string Libdl = "libdl.so";
     public const string Kernel32 = "kernel32.dll";
 
-    public static Efl.Eo.NativeModule EflModule = new Efl.Eo.NativeModule(Efl);
-    public static Efl.Eo.NativeModule CoreModule = new 
Efl.Eo.NativeModule(Ecore);
-    public static Efl.Eo.NativeModule EinaModule = new 
Efl.Eo.NativeModule(Eina);
-    public static Efl.Eo.NativeModule EoModule = new Efl.Eo.NativeModule(Eo);
-    public static Efl.Eo.NativeModule EvasModule = new 
Efl.Eo.NativeModule(Evas);
-    public static Efl.Eo.NativeModule EvilModule = new 
Efl.Eo.NativeModule(Evil);
-    public static Efl.Eo.NativeModule EdjeModule = new 
Efl.Eo.NativeModule(Edje);
-    public static Efl.Eo.NativeModule ElementaryModule = new 
Efl.Eo.NativeModule(Elementary);
-    public static Efl.Eo.NativeModule EldbusModule = new 
Efl.Eo.NativeModule(Eldbus);
-    public static Efl.Eo.NativeModule CustomExportsModule = new 
Efl.Eo.NativeModule(CustomExports);
-    public static Efl.Eo.NativeModule LibdlModule = new 
Efl.Eo.NativeModule(Libdl);
-    public static Efl.Eo.NativeModule Kernel32Module = new 
Efl.Eo.NativeModule(Kernel32);
+    public static readonly Efl.Eo.NativeModule EflModule = new 
Efl.Eo.NativeModule(Efl);
+    public static readonly Efl.Eo.NativeModule CoreModule = new 
Efl.Eo.NativeModule(Ecore);
+    public static readonly Efl.Eo.NativeModule EinaModule = new 
Efl.Eo.NativeModule(Eina);
+    public static readonly Efl.Eo.NativeModule EoModule = new 
Efl.Eo.NativeModule(Eo);
+    public static readonly Efl.Eo.NativeModule EvasModule = new 
Efl.Eo.NativeModule(Evas);
+    public static readonly Efl.Eo.NativeModule EvilModule = new 
Efl.Eo.NativeModule(Evil);
+    public static readonly Efl.Eo.NativeModule EdjeModule = new 
Efl.Eo.NativeModule(Edje);
+    public static readonly Efl.Eo.NativeModule ElementaryModule = new 
Efl.Eo.NativeModule(Elementary);
+    public static readonly Efl.Eo.NativeModule EldbusModule = new 
Efl.Eo.NativeModule(Eldbus);
+    public static readonly Efl.Eo.NativeModule CustomExportsModule = new 
Efl.Eo.NativeModule(CustomExports);
+    public static readonly Efl.Eo.NativeModule LibdlModule = new 
Efl.Eo.NativeModule(Libdl);
+    public static readonly Efl.Eo.NativeModule Kernel32Module = new 
Efl.Eo.NativeModule(Kernel32);
 }
 
 }
diff --git a/src/bindings/mono/eina_mono/eina_array.cs 
b/src/bindings/mono/eina_mono/eina_array.cs
index 617664b34e..17a3ee2e34 100644
--- a/src/bindings/mono/eina_mono/eina_array.cs
+++ b/src/bindings/mono/eina_mono/eina_array.cs
@@ -52,7 +52,7 @@ public static class ArrayNativeFunctions
 /// </summary>
 public class Array<T> : IEnumerable<T>, IDisposable
 {
-    public static uint DefaultStep = 32;
+    public const uint DefaultStep = 32;
 
     /// <summary>Pointer to the native buffer.</summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
diff --git a/src/bindings/mono/eina_mono/eina_error.cs 
b/src/bindings/mono/eina_mono/eina_error.cs
index 8292295e9d..7b5733d0ea 100644
--- a/src/bindings/mono/eina_mono/eina_error.cs
+++ b/src/bindings/mono/eina_mono/eina_error.cs
@@ -26,28 +26,28 @@ public struct Error : IComparable<Error>
     /// Unhandled Exception error identifier.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static Error UNHANDLED_EXCEPTION;
+    public static readonly Error UNHANDLED_EXCEPTION;
 
     /// <summary>
     /// No error identifier.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static Error NO_ERROR = new Error(0);
+    public static readonly Error NO_ERROR = new Error(0);
     /// <summary>
     /// Permission error identifier.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static Error EPERM = new Error(1);
+    public static readonly Error EPERM = new Error(1);
     /// <summary>
     /// No entity error identifier.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static Error ENOENT = new Error(2);
+    public static readonly Error ENOENT = new Error(2);
     /// <summary>
     /// Cancelled error identifier.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static Error ECANCELED = new Error(125);
+    public static readonly Error ECANCELED = new Error(125);
 
     /// <summary>
     /// Constructor.
diff --git a/src/bindings/mono/eina_mono/eina_inarray.cs 
b/src/bindings/mono/eina_mono/eina_inarray.cs
index a8c52374eb..9b2307a980 100644
--- a/src/bindings/mono/eina_mono/eina_inarray.cs
+++ b/src/bindings/mono/eina_mono/eina_inarray.cs
@@ -74,7 +74,7 @@ public static class InarrayNativeFunctions
 /// </summary>
 public class Inarray<T> : IEnumerable<T>, IDisposable
 {
-    public static uint DefaultStep = 0;
+    public const uint DefaultStep = 0;
     [EditorBrowsable(EditorBrowsableState.Never)]
     public IntPtr Handle {get;set;} = IntPtr.Zero;
     /// <summary>Whether this wrapper owns the native buffer.
diff --git a/src/bindings/mono/eina_mono/eina_log.cs 
b/src/bindings/mono/eina_mono/eina_log.cs
index 2671971550..ca9ee12939 100644
--- a/src/bindings/mono/eina_mono/eina_log.cs
+++ b/src/bindings/mono/eina_mono/eina_log.cs
@@ -69,51 +69,51 @@ public class Log
         /// <summary>Light red
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string LIGHTRED  = "\033[31;1m";
+        public const string LIGHTRED  = "\033[31;1m";
         /// <summary>Red
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string RED       = "\033[31m";
+        public const string RED       = "\033[31m";
         /// <summary>Light blue
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string LIGHTBLUE = "\033[34;1m";
+        public const string LIGHTBLUE = "\033[34;1m";
         /// <summary>Blue
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string BLUE      = "\033[34m";
+        public const string BLUE      = "\033[34m";
         /// <summary>Green
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string GREEN     = "\033[32;1m";
+        public const string GREEN     = "\033[32;1m";
         /// <summary>Yellow
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string YELLOW    = "\033[33;1m";
+        public const string YELLOW    = "\033[33;1m";
         /// <summary>Orange
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string ORANGE    = "\033[0;33m";
+        public const string ORANGE    = "\033[0;33m";
         /// <summary>White
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string WHITE     = "\033[37;1m";
+        public const string WHITE     = "\033[37;1m";
         /// <summary>Light cyan
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string LIGHTCYAN = "\033[36;1m";
+        public const string LIGHTCYAN = "\033[36;1m";
         /// <summary>Cyan
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string CYAN      = "\033[36m";
+        public const string CYAN      = "\033[36m";
         /// <summary>Reset
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string RESET     = "\033[0m";
+        public const string RESET     = "\033[0m";
         /// <summary>Bold
         /// <para>Since EFL 1.23.</para>
         /// </summary>
-        public static string HIGH      = "\033[1m";
+        public const string HIGH      = "\033[1m";
     }
 
     private static int domain = -1;
diff --git a/src/bindings/mono/eina_mono/eina_value.cs 
b/src/bindings/mono/eina_mono/eina_value.cs
index f2e4c17ec0..d70d9e64d0 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -3591,7 +3591,7 @@ public class ValueTypeMarshaler : ICustomMarshaler
         var r = ValueTypeBridge.GetManaged(pNativeData);
         return new ValueTypeBox(r);
     }
-    public static Eina.ValueType vtype;
+    public static readonly Eina.ValueType vtype;
 
     /// <summary>Retrieves the C pointer from a given boxed enum value 
type.</summary>
     public IntPtr MarshalManagedToNative(object managedObj)
diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs 
b/src/bindings/mono/eldbus_mono/eldbus_common.cs
index 39c2d039d6..80b1e25c60 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_common.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs
@@ -10,7 +10,7 @@ namespace eldbus
 
 public static class Timeout
 {
-    public static int Infinite = 0x7fffffff;
+    public const int Infinite = 0x7fffffff;
 }
 
 [StructLayout(LayoutKind.Sequential)]
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs 
b/src/bindings/mono/eo_mono/iwrapper.cs
index ae39b6139a..cc9e47ed10 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -36,12 +36,12 @@ public class Globals
 
     [return: MarshalAs(UnmanagedType.U1)]
     public delegate bool efl_object_init_delegate();
-    public static FunctionWrapper<efl_object_init_delegate> 
efl_object_init_ptr =
+    public static readonly FunctionWrapper<efl_object_init_delegate> 
efl_object_init_ptr =
         new FunctionWrapper<efl_object_init_delegate>(efl.Libs.EoModule, 
"efl_object_init");
     public static bool efl_object_init() => 
efl_object_init_ptr.Value.Delegate();
 
     public delegate void efl_object_shutdown_delegate();
-    public static FunctionWrapper<efl_object_shutdown_delegate> 
efl_object_shutdown_ptr = new 
FunctionWrapper<efl_object_shutdown_delegate>(efl.Libs.EoModule, 
"efl_object_shutdown");
+    public static readonly FunctionWrapper<efl_object_shutdown_delegate> 
efl_object_shutdown_ptr = new 
FunctionWrapper<efl_object_shutdown_delegate>(efl.Libs.EoModule, 
"efl_object_shutdown");
     public static void efl_object_shutdown() => 
efl_object_shutdown_ptr.Value.Delegate();
     // [DllImport(efl.Libs.Eo)] public static extern void 
efl_object_shutdown();
 
@@ -996,10 +996,10 @@ public static class ClassRegister
         typeFromKlass[klassPtr] = objectType;
     }
 
-    public static 
System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr> 
klassFromType
+    public static readonly 
System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr> 
klassFromType
         = new System.Collections.Concurrent.ConcurrentDictionary<System.Type, 
System.IntPtr>();
 
-    public static 
System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type> 
typeFromKlass
+    public static readonly 
System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type> 
typeFromKlass
         = new 
System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, 
System.Type>();
 
     private static readonly object klassAllocLock = new object();

-- 


Reply via email to