Remove ClassInitializer attributes.

* AssemblyInfo.cs.in: remove the ignore attr from the assemblies.
* glib/ClassInitializerAttribute.cs: remove obsolete method target attr.
* glib/IgnoreClassInitializersAttribute.cs: remove.
* glib/Makefile.am: update sources and stop copying AssemblyInfo.cs around.
* glib/Object.cs: remove the obsolete ClassInitializer fallback mechanism.
This commit is contained in:
Mike Kestner 2011-02-09 10:05:40 -06:00
parent f125031297
commit 7cdaf34aa2
5 changed files with 5 additions and 83 deletions

View File

@ -3,4 +3,3 @@ using System.Runtime.CompilerServices;
[assembly:AssemblyVersion("@API_VERSION@")]
[assembly:AssemblyDelaySign(false)]
[assembly:GLib.IgnoreClassInitializers]

View File

@ -1,31 +0,0 @@
// ClassInitializerAttribute.cs
//
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2004 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GLib {
using System;
[Obsolete ("Replaced by TypeInitializerAttribute")]
public sealed class ClassInitializerAttribute : Attribute
{
public ClassInitializerAttribute () {}
}
}

View File

@ -1,31 +0,0 @@
// IgnoreClassInitializersAttribute.cs
//
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2007 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GLib {
using System;
[AttributeUsage (AttributeTargets.Assembly)]
public sealed class IgnoreClassInitializersAttribute : Attribute
{
public IgnoreClassInitializersAttribute () {}
}
}

View File

@ -10,7 +10,7 @@ pkgconfig_DATA = glib-sharp-3.0.pc
gapidir = $(datadir)/gapi-3.0
gapi_DATA = glib-api.xml
CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb AssemblyInfo.cs $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS)
CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS)
DISTCLEANFILES = $(ASSEMBLY).config
POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY), $(addprefix policy., $(POLICY_VERSIONS)))
@ -22,7 +22,6 @@ sources = \
Argv.cs \
Boxed.cs \
CDeclCallbackAttribute.cs \
ClassInitializerAttribute.cs \
ConnectBeforeAttribute.cs \
DefaultSignalHandlerAttribute.cs \
DelegateWrapper.cs \
@ -39,7 +38,6 @@ sources = \
GType.cs \
GTypeAttribute.cs \
Idle.cs \
IgnoreClassInitializersAttribute.cs \
InitiallyUnowned.cs \
IOChannel.cs \
IWrapper.cs \
@ -79,7 +77,7 @@ sources = \
Value.cs \
Variant.cs
build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs
build_sources = $(addprefix $(srcdir)/, $(sources)) $(top_builddir)/AssemblyInfo.cs
dist_sources = $(sources)
EXTRA_DIST = \
@ -88,10 +86,7 @@ EXTRA_DIST = \
glib-sharp-3.0.pc.in \
glib-api.xml
AssemblyInfo.cs: $(top_builddir)/AssemblyInfo.cs
cp $(top_builddir)/AssemblyInfo.cs .
$(ASSEMBLY): $(build_sources) $(SNK) AssemblyInfo.cs
$(ASSEMBLY): $(build_sources) $(SNK)
@rm -f $(ASSEMBLY).mdb
$(CSC) $(CSFLAGS) -keyfile:$(SNK) -unsafe -nowarn:0169,0612,0618 -out:$(ASSEMBLY) -target:library $(references) $(build_sources)

View File

@ -151,7 +151,7 @@ namespace GLib {
}
private static void InvokeClassInitializers (GType gtype, System.Type t)
private static void InvokeTypeInitializers (GType gtype, System.Type t)
{
object[] parms = {gtype, t};
@ -162,16 +162,6 @@ namespace GLib {
if (m != null)
m.Invoke (null, parms);
}
for (Type curr = t; curr != typeof(GLib.Object); curr = curr.BaseType) {
if (curr.Assembly.IsDefined (typeof (IgnoreClassInitializersAttribute), false))
continue;
foreach (MethodInfo minfo in curr.GetMethods(flags))
if (minfo.IsDefined (typeof (ClassInitializerAttribute), true))
minfo.Invoke (null, parms);
}
}
// Key: The pointer to the ParamSpec of the property
@ -376,7 +366,7 @@ namespace GLib {
}
AddProperties (gtype, t, is_first_subclass);
ConnectDefaultHandlers (gtype, t);
InvokeClassInitializers (gtype, t);
InvokeTypeInitializers (gtype, t);
AddInterfaces (gtype, t);
return gtype;
}