[banshee] [build] Started IntPtr ctor verification tool
- From: Aaron Bockover <abock src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [build] Started IntPtr ctor verification tool
- Date: Sat, 22 May 2010 21:31:41 +0000 (UTC)
commit 88bc17d8024b9ae2ced4d2f025870d000ac6bbca
Author: Aaron Bockover <abockover novell com>
Date: Sat May 22 17:18:59 2010 -0400
[build] Started IntPtr ctor verification tool
Exposes types derived from GLib.Object that do not implement a protected
or public constructor accepting a single IntPtr as a parameter. Still
needs to verify that matching constructors chain up to the matching base
constructor.
build/GObjectIntPtrCtorVerifier.cs | 39 ++++++++++++++++++++++++++++++++++++
build/Makefile.am | 6 ++++-
2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/build/GObjectIntPtrCtorVerifier.cs b/build/GObjectIntPtrCtorVerifier.cs
new file mode 100644
index 0000000..3c3ba9c
--- /dev/null
+++ b/build/GObjectIntPtrCtorVerifier.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Reflection;
+
+public static class GObjectIntPtrCtorVerifier
+{
+ public static void Main (string [] args)
+ {
+ foreach (var path in args) {
+ Verify (path);
+ }
+ }
+
+ private static void Verify (string path)
+ {
+ foreach (var type in Assembly.LoadFrom (path).GetTypes ()) {
+ if (!type.IsSubclassOf (typeof (GLib.Object))) {
+ continue;
+ }
+
+ bool safe = false;
+
+ foreach (var ctor in type.GetConstructors (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) {
+ var args = ctor.GetParameters ();
+ if ((safe = (ctor.Attributes & (MethodAttributes.Public |
+ MethodAttributes.Family)) != 0 &&
+ args != null &&
+ args.Length == 1 &&
+ args[0].ParameterType == typeof (IntPtr))) {
+ break;
+ }
+ }
+
+ if (!safe) {
+ Console.WriteLine (type);
+ }
+ }
+ }
+}
+
diff --git a/build/Makefile.am b/build/Makefile.am
index 4cd501c..173e36e 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -4,8 +4,9 @@ GCONF_SCHEMA_EXTRACTOR_ASSEMBLY = gconf-schema-extractor.exe
TRANSLATOR_EXTRACTOR_ASSEMBLY = translator-extractor.exe
DLL_MAP_VERIFIER_ASSEMBLY = dll-map-verifier.exe
ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY = addin-xml-string-extractor.exe
+GOBJECT_INTPTR_CTOR_VERIFIER_ASSEMBLY = gobject-intptr-ctor-verifier.exe
-ALL_TARGETS = $(TRANSLATOR_EXTRACTOR_ASSEMBLY) $(DLL_MAP_VERIFIER_ASSEMBLY) $(ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY)
+ALL_TARGETS = $(TRANSLATOR_EXTRACTOR_ASSEMBLY) $(DLL_MAP_VERIFIER_ASSEMBLY) $(ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY) $(GOBJECT_INTPTR_CTOR_VERIFIER_ASSEMBLY)
if GCONF_SCHEMAS_INSTALL
bansheedir = $(pkglibdir)
@@ -29,6 +30,9 @@ $(DLL_MAP_VERIFIER_ASSEMBLY): DllMapVerifier.cs
$(ADDIN_XML_STRING_EXTRACTOR_ASSEMBLY): AddinXmlStringExtractor.cs
$(MCS) -r:System.Xml -out:$@ $<
+$(GOBJECT_INTPTR_CTOR_VERIFIER_ASSEMBLY): GObjectIntPtrCtorVerifier.cs
+ $(MCS) $(GLIBSHARP_LIBS) -out:$@ $<
+
EXTRA_DIST = \
icon-theme-installer \
private-icon-theme-installer \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]