generator: Fix compilation warning in some generated interface adapters

Don't generate a static field if it's not going to be used.

This fixes a compilation warning on the generated code for interfaces
that don't have virtual methods.
This commit is contained in:
Bertrand Lorentz 2012-11-18 11:10:18 +01:00
parent 0bc9ab9fd4
commit f0f998ccf3

View file

@ -103,8 +103,10 @@ namespace GtkSharp.Generation {
void GenerateInitialize (StreamWriter sw) void GenerateInitialize (StreamWriter sw)
{ {
if (interface_vms.Count > 0) {
sw.WriteLine ("\t\tstatic int class_offset = 2 * IntPtr.Size;"); // Class size of GTypeInterface struct sw.WriteLine ("\t\tstatic int class_offset = 2 * IntPtr.Size;"); // Class size of GTypeInterface struct
sw.WriteLine (); sw.WriteLine ();
}
sw.WriteLine ("\t\tstatic void Initialize (IntPtr ptr, IntPtr data)"); sw.WriteLine ("\t\tstatic void Initialize (IntPtr ptr, IntPtr data)");
sw.WriteLine ("\t\t{"); sw.WriteLine ("\t\t{");
if (interface_vms.Count > 0) { if (interface_vms.Count > 0) {