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 657378 - Passing variable arguments to vprintf does not work
Passing variable arguments to vprintf does not work
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-25 20:28 UTC by Fabian Sturm
Modified: 2011-10-17 20:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Fix destroying values that forbid lvalue access in transform_value (4.37 KB, patch)
2011-08-26 18:27 UTC, Luca Bruno
none Details | Review

Description Fabian Sturm 2011-08-25 20:28:39 UTC
The following vala code:

  void test (string format, ...) {
    string msg = format.vprintf (va_list ());
  }

is translated to this C code:

  void test (const gchar* format, ...) {
	va_list _tmp0_;
	va_list _tmp1_;
	va_list _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar* msg;
	g_return_if_fail (format != NULL);
	va_start (_tmp0_, format);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_vprintf (format, _tmp2_);
	_tmp4_ = _tmp3_;
	va_end (_tmp2_);
	msg = _tmp4_;
	_g_free0 (msg);
  }

with when compiled produces these errors:

debug.c:163:9: error: incompatible types when assigning to type ‘va_list’ from type ‘struct __va_list_tag *’
debug.c:164:9: error: incompatible types when assigning to type ‘va_list’ from type ‘struct __va_list_tag *’

which are these lines: 

	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;

Sincerely Fabian
Comment 1 Luca Bruno 2011-08-26 09:27:21 UTC
commit 2a526194a2117988effd2f798f9447fbd5981c18
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Fri Aug 26 09:34:15 2011 +0200

    codegen: Drop useless temp variable when creating structs
    
    Partially fixes 657378.
Comment 2 Luca Bruno 2011-08-26 18:27:03 UTC
Created attachment 194873 [details] [review]
codegen: Fix destroying values that forbid lvalue access in transform_value

Fixes bug 657378.
Comment 3 Luca Bruno 2011-10-17 20:19:30 UTC
commit 4c0c5242cecef9d9e4f9c90cf934434416020524
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Mon Oct 17 21:56:49 2011 +0200

    codegen: Don't create temp var in transform_value if lvalue isn't allowed
    
    Fixes bug 657378.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.