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 788181 - Bug in GnuTLS binding gnutls.vapi
Bug in GnuTLS binding gnutls.vapi
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.36.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-26 11:31 UTC by getzze
Modified: 2017-09-29 11:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnutls: Fix free_function ccode-attribute of Certificate (970 bytes, patch)
2017-09-29 10:56 UTC, Rico Tzschichholz
committed Details | Review

Description getzze 2017-09-26 11:31:49 UTC
An extra space is present in gnutls.vapi so the .c file is generated with errors:

error: ‘var’ undeclared (first use in this function); did you mean ‘char’?
 #define _gnutls_x509_crt_deinit 0(var) ((var == NULL) ? NULL : (var = (gnutls_x509_crt_deinit  (var), NULL)))


Fix by removing the extra space:

911c911
< 		[CCode (cname = "struct gnutls_x509_crt_int", cprefix = "gnutls_x509_crt_", free_function = "gnutls_x509_crt_deinit ")]
---
> 		[CCode (cname = "struct gnutls_x509_crt_int", cprefix = "gnutls_x509_crt_", free_function = "gnutls_x509_crt_deinit")]
1888d1887
<
Comment 1 Al Thomas 2017-09-29 09:32:50 UTC
I'm surprised a space makes a difference to the C compiler.

This binding is maintained manually so a git formatted patch of your diff would be good.
Comment 2 Rico Tzschichholz 2017-09-29 10:56:29 UTC
Created attachment 360655 [details] [review]
gnutls: Fix free_function ccode-attribute of Certificate

Remove an extra space which breaks null-safe free-wrapper generation.

Thanks to getzze
Comment 3 Rico Tzschichholz 2017-09-29 10:58:22 UTC
Attachment 360655 [details] pushed as 3e35aec - gnutls: Fix free_function ccode-attribute of Certificate
Comment 4 getzze 2017-09-29 11:34:35 UTC
(In reply to Al Thomas from comment #1)
> I'm surprised a space makes a difference to the C compiler.
> 

You are right that this is probably a bug in the C compiler.
Although this is solved, maybe it would be good to make another bug report for the general case.
Comment 5 Al Thomas 2017-09-29 11:41:42 UTC
(In reply to getzze from comment #4)
> You are right that this is probably a bug in the C compiler.

Out of curiosity, which C compiler are you using?

The Vala compiler only produces the C code and then uses an external C compiler to produce the binary. So any bug in Vala would be if it produced non-standard C. I'm not sure what the general case would be here.
Comment 6 getzze 2017-09-29 11:49:45 UTC
no, sorry I meant it's a bug in the vala compiler (that produces the C code).
As I said, my .vala code translated to `_gnutls_x509_crt_deinit 0` for boxing the object.
That is not a wanted behavior I think. Maybe valac should strip the cprefix and cnames before using them. Or give an error message if the user puts a space  (or any other problematic character) in the name.
I'm using gcc-7.2.0 on ArchLinux