}
}
+ var needs_format_arg = m.get_format_arg_index () < 0 && (m.printf_format || m.scanf_format);
+
+ CCodeParameter? prev_cparam = null;
foreach (Parameter param in m.get_parameters ()) {
if (param.direction != ParameterDirection.OUT) {
if ((direction & 1) == 0) {
}
}
- generate_parameter (param, decl_space, cparam_map, carg_map);
+ var cparam = generate_parameter (param, decl_space, cparam_map, carg_map);
+
+ // if there is no explicit FormatArg annotation while this method throws an error
+ // it is required to mark the parameter located right before ellipsis as format-arg
+ // to account for the parameter shifting caused by the inserted GError parameter
+ if (needs_format_arg) {
+ if (prev_cparam != null && cparam.ellipsis) {
+ prev_cparam.modifiers |= CCodeModifiers.FORMAT_ARG;
+ }
+ prev_cparam = cparam;
+ }
}
if ((direction & 2) != 0) {
methods/bug771964.vala \
methods/bug774060.vala \
methods/bug775466.test \
+ methods/bug781061.vala \
methods/generics.vala \
methods/printf-invalid.test \
methods/printf-constructor.vala \
--- /dev/null
+errordomain FooError {
+ FAILED;
+}
+
+[PrintfFormat]
+void print_something_throws (bool ok, string format, ...) throws FooError {
+ var vargs = va_list ();
+ print_something_vargs_throws (ok, format, vargs);
+}
+
+[PrintfFormat]
+void print_something_vargs_throws (bool ok, string format, va_list vargs) throws FooError {
+}
+
+[ScanfFormat]
+void scan_something_throws (bool ok, string format, ...) throws FooError {
+}
+
+[ScanfFormat]
+void scan_something_vargs_throws (bool ok, string format, va_list vargs) throws FooError {
+}
+
+void main () {
+ try {
+ print_something_throws (true, "%s", "foo");
+ int i;
+ scan_something_throws (false, "%d", out i);
+ } catch (FooError e) {
+ }
+}