Christoph Rupp created THRIFT-1925:
--------------------------------------
Summary: c_glib generated code does not compile
Key: THRIFT-1925
URL: https://issues.apache.org/jira/browse/THRIFT-1925
Project: Thrift
Issue Type: Bug
Components: C glib - Compiler
Affects Versions: 0.9, 0.8
Environment: Linux wintermute 3.5.0-21-generic #32-Ubuntu SMP Tue Dec
11 18:51:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
Reporter: Christoph Rupp
I am trying to build the Hypertable thrift bindings for C_glib, but the
generated files fail to compile.
Here is the error message:
{noformat}
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c: In
function ‘result_as_arrays_read’:
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:2708:19:
warning: passing argument 1 of ‘g_ptr_array_add’ from incompatible pointer type
[enabled by default]
In file included from /usr/include/glib-2.0/glib.h:33:0,
from /usr/include/glib-2.0/gobject/gbinding.h:30,
from /usr/include/glib-2.0/glib-object.h:25,
from
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.h:11,
from
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:8:
/usr/include/glib-2.0/glib/garray.h:139:12: note: expected ‘struct GPtrArray *’
but argument is of type ‘struct GPtrArray **’
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c: In
function ‘result_as_arrays_write’:
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:2854:140:
warning: dereferencing ‘void *’ pointer [enabled by default]
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:2854:140:
error: request for member ‘len’ in something not a structure or union
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:2858:78:
warning: dereferencing ‘void *’ pointer [enabled by default]
/home/chris/ht/hypertable/src/c/ThriftClient/gen-c_glib/client_types.c:2858:78:
error: request for member ‘len’ in something not a structure or union
make[2]: ***
[src/c/ThriftClient/CMakeFiles/HyperThriftC.dir/gen-c_glib/client_types.c.o]
Error 1
make[1]: *** [src/c/ThriftClient/CMakeFiles/HyperThriftC.dir/all] Error 2
make: *** [all] Error 2
{noformat}
Here is client_types.c:2858:
{noformat}
for (i=0; i<g_ptr_array_index ((GPtrArray *) this_object->cells, i)->len; i++)
{noformat}
I added another casst to GPtrArray *, and then the code compiles:
{noformat}
for (i=0; i<((GPtrArray *)(g_ptr_array_index ((GPtrArray *) this_object->cells,
i)))->len; i++)
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira