GNOME Bugzilla – Bug 788181
Bug in GnuTLS binding gnutls.vapi
Last modified: 2017-09-29 11:49:45 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 <
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.
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
Attachment 360655 [details] pushed as 3e35aec - gnutls: Fix free_function ccode-attribute of Certificate
(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.
(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.
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