Bug 19461

Summary: Avoid empty structs in svc code generation
Product: Telepathy Reporter: Sunil Mohan Adapa <sunil>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to fix Windows compilation errros

Description Sunil Mohan Adapa 2009-01-08 05:18:31 UTC
Created attachment 21802 [details] [review]
Patch to fix Windows compilation errros

When compiling on Windows msvc compiler, I had three problems with telepathy-glib.

1) unistd.h was not available. Attached patch conditionally includes it.
2) msvc compiler does allow void pointer arithmetic. I type casted it to guint8* for addition because that is what we meant.
3) msvc compiler seems have problems with empty structures. One private member structure for a class was empty. For lack of better ideas, I removed the structure.
Comment 1 Xavier Claessens 2009-01-08 05:23:15 UTC
For (2) and (3) GCC can warning. I don't know which flags are needed, but for Empathy that kind of code generate a warning.
Comment 2 Simon McVittie 2009-01-08 05:51:18 UTC
1) Thanks, patch applied in git.

2) Coincidentally I fixed this bug, and added the warning Xavier mentioned, just before Christmas :-) The patch was merged in git yesterday.

3) Thanks, patch applied in git. I can't find a warning option that would warn about use of this gcc extension, though.

There should hopefully be a release with all three fixes later today.
Comment 3 Sunil Mohan Adapa 2009-01-08 06:29:57 UTC
Thanks Simon,

I also had to make the following change in the generated code. I don't recollect perfectly but I think it was because of the empty initialization. Should the code generator be fixed?

--- telepathy-glib/telepathy-glib/_gen/tp-svc-channel.c
+++ telepathy-glib/telepathy-glib/_gen/tp-svc-channel.c

@@ -2122,12 +2122,10 @@ tp_svc_channel_type_contact_list_base_in
       tp_svc_channel_type_contact_list_base_init_once (klass);
     }
 }
-static const DBusGMethodInfo _tp_svc_channel_type_contact_list_methods[] = {
-};

 static const DBusGObjectInfo _tp_svc_channel_type_contact_list_object_info = {
   0,
-  _tp_svc_channel_type_contact_list_methods,
+  NULL,
   0,
 "\0",
 "\0\0",
Comment 4 Simon McVittie 2009-01-12 04:54:05 UTC
Retitling to reflect the remaining change. We should edit the code-generator rather than the generated code.
Comment 5 Simon McVittie 2009-01-29 06:21:19 UTC
Fixed in 0.7.23

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.