[
https://issues.apache.org/jira/browse/THRIFT-3178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14661759#comment-14661759
]
ASF GitHub Bot commented on THRIFT-3178:
----------------------------------------
GitHub user simonsouth opened a pull request:
https://github.com/apache/thrift/pull/581
THRIFT-3178: c_glib does not compile
These changes allow Hypertable's Thrift interface to be compiled by the C
(GLib) compiler by correcting the way the compiler handles "compound" and
typedef'd list types. The changes include
- Adding test cases for list-of-string-list containers (variables of type
list<list<string>>) returned by service methods, both aliased with a typedef
and not;
- Modifying the compiler to
- Initialize list variables (pointer arrays) in the generated code before
they are used,
- Correctly identify the type of typedef'd list elements and
- Omit the dereference operator ("*") in typedef'd types to match the way
they would naturally be used in client code.
The final commit refactors the test cases to put common code related to
creating a service client in its own function.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/simonsouth/thrift
thrift-3178-c_glib-does-not-compile
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/581.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #581
----
commit cc87b14bf2f895dc0ceb470008473256c6921517
Author: Simon South <[email protected]>
Date: 2015-08-07T10:31:35Z
c_glib: Add unit test for lists of string lists
Adds a unit test that covers lists of lists of strings returned
from service methods.
commit c2d7276500842ae3901b6d7835f467de7577a9bb
Author: Simon South <[email protected]>
Date: 2015-08-07T10:32:54Z
c_glib: Compiler: Create list variables before use
With this change generated code will create list (i.e. g_ptr_array)
variables before using them. This prevents an assertion failure
when deserializing a list from a service-method response.
commit 906f2a671ad7731e7f6760deff6e0517d0f202b4
Author: Simon South <[email protected]>
Date: 2015-08-07T11:41:43Z
c_glib: Add unit test for typedef'd lists of string lists
Adds a service-handler method and unit test that duplicates the
existing test for lists of string lists returned from service
methods, but adds the use of typedef'd types.
commit 21a436134d956983facf63163a6a39443a8c7a7d
Author: Simon South <[email protected]>
Date: 2015-08-07T11:43:21Z
c_glib: Compiler: Correctly handle typedef'd list types
With this change the compiler will emit code that correctly handles
typedef'd list types returned from service methods. The specific
changes are
- Omit the dereference operator ("*") from container type names
output in typedef statements, to allow the type to be used as
a programmer would expect in client code; and
- Determine the underlying type of a list's typedef'd elements when
generating code to serialize those elements.
commit 2d6384bafcc832134c9f705bb5d75da4f0414d00
Author: Simon South <[email protected]>
Date: 2015-08-07T12:18:00Z
c_glib: testcontainertest.c: Factor out common code
Add a helper method that executes a test case against a newly
constructed service client, then refactor the test methods to use
this helper.
----
> glib C does not compile
> -----------------------
>
> Key: THRIFT-3178
> URL: https://issues.apache.org/jira/browse/THRIFT-3178
> Project: Thrift
> Issue Type: Bug
> Components: C glib - Compiler, C glib - Library
> Affects Versions: 0.9.2
> Environment: Ubuntu GCC, CGLIB 2 Hypertable
> Reporter: nijx
> Assignee: Simon South
> Labels: Hypertable
>
> Generated glibc files in c compile error
> /home/ubuntu/Downloads/ht_thrf/gen-c_glib/client_service.c: In function
> ‘client_service_client_recv_scanner_get_cells_as_arrays’:
> /home/node/ubuntu/ht_thrf/gen-c_glib/client_service.c:8525:38: warning:
> passing argument 1 of ‘g_ptr_array_add’ from incompatible pointer type
> g_ptr_array_add (_elem119, _elem120);
> ^
> In file included from /usr/include/glib-2.0/glib.h:31:0,
> from /usr/include/glib-2.0/gobject/gbinding.h:28,
> from /usr/include/glib-2.0/glib-object.h:23,
> from
> /opt/hypertable/current/include/thrift/c_glib/transport/thrift_socket.h:23,
> from <command-line>:1:
> /usr/include/glib-2.0/glib/garray.h:168:12: note: expected ‘struct GPtrArray
> *’ but argument is of type ‘struct GPtrArray **’
> void g_ptr_array_add (GPtrArray *array,
> ^
> /home/ubuntu/Downloads/ht_thrf/gen-c_glib/client_service.c: In function
> ‘client_service_client_recv_next_cells_as_arrays’:
> /home/node/Downloads/ht_thrf/gen-c_glib/client_service.c:8771:38: warning:
> passing argument 1 of ‘g_ptr_array_add’ from incompatible pointer type
> g_ptr_array_add (_elem121, _elem122);
> ^
> In file included from /usr/include/glib-2.0/glib.h:31:0,
> from /usr/include/glib-2.0/gobject/gbinding.h:28,
> from /usr/include/glib-2.0/glib-object.h:23,
> from
> /opt/hypertable/current/include/thrift/c_glib/transport/thrift_socket.h:23,
> from <command-line>:1:
> /usr/include/glib-2.0/glib/garray.h:168:12: note: expected ‘struct GPtrArray
> *’ but argument is of type ‘struct GPtrArray **’
> void g_ptr_array_add (GPtrArray *array,
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)