+2006-10-31 Jürg Billeter <j@bitron.ch>
+
+ * vala/valacodegenerator.vala: don't add NULL to end of variable
+ argument list for printf-style functions to reduce the number of
+ warnings during C compilation
+ * vala/valamethod.vala: support PrintfFormat attribute
+ * vala/vala.h: include valareport.h
+ * vapi/glib-2.0.vala: use PrintfFormat attribute
+
2006-10-27 Jürg Billeter <j@bitron.ch>
* vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala:
#include <vala/valaproperty.h>
#include <vala/valapropertyaccessor.h>
#include <vala/valarealliteral.h>
+#include <vala/valareport.h>
#include <vala/valareturnstatement.h>
#include <vala/valasignal.h>
#include <vala/valasourcefile.h>
if (m != null && m.instance && m.instance_last) {
ccall.add_argument (instance);
} else if (ellipsis) {
- // ensure variable argument list ends with NULL
- ccall.add_argument (new CCodeConstant ("NULL"));
+ /* ensure variable argument list ends with NULL
+ * except when using printf-style arguments */
+ if (m == null || !m.printf_format) {
+ ccall.add_argument (new CCodeConstant ("NULL"));
+ }
}
if (m != null && m.instance && m.returns_modified_pointer) {
}
}
}
+
+ /**
+ * Specifies whether this method expects printf-style format arguments.
+ */
+ public bool printf_format { get; set; }
private bool _instance = true;
private List<FormalParameter> parameters;
return_type.floating_reference = true;
} else if (a.name == "NoArrayLength") {
no_array_length = true;
+ } else if (a.name == "PrintfFormat") {
+ printf_format = true;
}
}
}
[CCode (cname = "g_str_has_suffix")]
public bool has_suffix (string! suffix);
[CCode (cname = "g_strdup_printf")]
+ [PrintfFormat ()]
public ref string printf (...);
[CCode (cname = "g_strconcat")]
public ref string concat (string string2, ...);
[CCode (cname = "fdopen")]
public static ref File fdopen (int fildes, string mode);
[CCode (cname = "fprintf")]
+ [PrintfFormat ()]
public void printf (string format, ...);
[InstanceLast ()]
[CCode (cname = "fputc")]