After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 643088 - valac generates invalid C code for abstract variadic functions
valac generates invalid C code for abstract variadic functions
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GObject
0.41.x
Other Linux
: Normal major
: 1.0
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-02-23 16:35 UTC by Derek Dai
Modified: 2018-05-16 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vala: Abstract and virtual methods may not be variadic (1.70 KB, patch)
2018-05-14 12:56 UTC, Rico Tzschichholz
committed Details | Review

Description Derek Dai 2011-02-23 16:35:17 UTC
interface Foo
{
	public abstract void bar(int param1, ...);
}

valac generates code below

void foo_bar (Foo* self, gint param1, ...) {
	FOO_GET_INTERFACE (self)->bar (self, param1);
}

Should be

void foo_bar (Foo* self, gint param1, ...) {
	va_list argv;
	va_start(argv, param1);
	FOO_GET_INTERFACE (self)->bar_va (self, param1, argv);
	va_end(argv);
}
Comment 1 Luca Bruno 2011-08-15 19:53:51 UTC
It shouldn't be allowed to define virtual/abstract methods with ellipsis.
Comment 2 Rico Tzschichholz 2018-05-14 12:56:45 UTC
Created attachment 372008 [details] [review]
vala: Abstract and virtual methods may not be variadic

The chain-up of the variadic parameter is not possible.
Comment 3 Rico Tzschichholz 2018-05-15 05:42:56 UTC
Attachment 372008 [details] pushed as 5fb5abc - vala: Abstract and virtual methods may not be variadic
Comment 4 Michael Catanzaro 2018-05-16 14:54:28 UTC
This broke tracker:

libtracker-data.vapi:66.3-66.46: error: Abstract and virtual methods may not be variadic. Use a `va_list'
 parameter instead of `...'.
                public abstract DBStatement create_statement (DBStatementCacheType cache_type, ...) throw
s DBInterfaceError;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tracker-sparql-pattern.vala:47.11-49.88: error: var declaration not allowed with non-typed initializer
tracker-sparql-pattern.vala:50.7-50.10: error: The name `stmt' does not exist in the context of `Tracker.
Sparql.PredicateVariable.get_sql_query'
                                                stmt.bind_int (0, subject_id);
                                                ^^^^
tracker-sparql-pattern.vala:51.16-51.19: error: The name `stmt' does not exist in the context of `Tracker
.Sparql.PredicateVariable.get_sql_query'
                                                cursor = stmt.start_cursor ();
                                                         ^^^^
tracker-sparql-pattern.vala:95.10-97.87: error: var declaration not allowed with non-typed initializer
tracker-sparql-pattern.vala:98.6-98.9: error: The name `stmt' does not exist in the context of `Tracker.S
parql.PredicateVariable.get_sql_query'
                                        stmt.bind_int (0, object_id);
                                        ^^^^
tracker-sparql-pattern.vala:99.10-99.38: error: var declaration not allowed with non-typed initializer
                                        var cursor = stmt.start_cursor ();
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tracker-sparql-pattern.vala:102.10-102.15: error: The name `cursor' does not exist in the context of `Tra
cker.Sparql.PredicateVariable.get_sql_query'
                                        if (cursor != null) {
                                            ^^^^^^
tracker-sparql-pattern.vala:103.14-103.19: error: The name `cursor' does not exist in the context of `Tra
cker.Sparql.PredicateVariable.get_sql_query'
                                                while (cursor.next ()) {
                                                       ^^^^^^
tracker-sparql-pattern.vala:104.49-104.54: error: The name `cursor' does not exist in the context of `Tracker.Sparql.PredicateVariable.get_sql_query'
                                                        var range = ontologies.get_class_by_uri (cursor.get_string (0));
                                                                                                 ^^^^^^
tracker-sparql-query.vala:517.7-517.115: error: var declaration not allowed with non-typed initializer
                var stmt = iface.create_statement (no_cache ? DBStatementCacheType.NONE : DBStatementCacheType.SELECT, "%s", sql);
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tracker-sparql-query.vala:524.6-524.9: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                        stmt.bind_int (i, 1);
                                        ^^^^
tracker-sparql-query.vala:526.6-526.9: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                        stmt.bind_int (i, 0);
                                        ^^^^
tracker-sparql-query.vala:531.5-531.8: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                stmt.bind_int (i, (int) string_to_date (binding.literal + "T00:00:00Z", null));
                                ^^^^
tracker-sparql-query.vala:533.5-533.8: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                stmt.bind_double (i, string_to_date (binding.literal, null));
                                ^^^^
tracker-sparql-query.vala:535.5-535.8: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                stmt.bind_int (i, int.parse (binding.literal));
                                ^^^^
tracker-sparql-query.vala:537.5-537.8: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                                stmt.bind_text (i, binding.literal);
                                ^^^^
tracker-sparql-query.vala:542.10-542.13: error: The name `stmt' does not exist in the context of `Tracker.Sparql.Query.prepare_for_exec'
                return stmt;
                       ^^^^
Compilation failed: 19 error(s), 0 warning(s)
Comment 5 Rico Tzschichholz 2018-05-16 14:59:24 UTC
(In reply to Michael Catanzaro from comment #4)
> This broke tracker:
> 

See https://bugzilla.gnome.org/show_bug.cgi?id=796104
Comment 6 Michael Catanzaro 2018-05-16 15:05:51 UTC
(In reply to Rico Tzschichholz from comment #5)
> (In reply to Michael Catanzaro from comment #4)
> > This broke tracker:
> > 
> 
> See https://bugzilla.gnome.org/show_bug.cgi?id=796104

OK, please just push directly next time, I was about to revert this. Thanks!