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.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---