[ 
https://issues.apache.org/jira/browse/THRIFT-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14644472#comment-14644472
 ] 

ASF GitHub Bot commented on THRIFT-3273:
----------------------------------------

GitHub user simonsouth opened a pull request:

    https://github.com/apache/thrift/pull/568

    c_glib: Compiler: Do not try to convert between function, void pointers

    This patch corrects THRIFT-3273 by introducing the notion of a 
"processing-function definition", a structure that associates the name of a 
service method with the processing function that processes invocations of it. 
This places the function's pointer within a data object, which can then safely 
be added to the process_map hash table.
    
    Defining an array of processing-function definitions for each processor 
also allows its instance initializer to be simplified as the process_map table 
can now be loaded with just a loop.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/simonsouth/thrift 
thrift-3273-c_glib-generated-code-tries-to-convert-function-void-pointers

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/568.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 #568
    
----
commit 84353197a98a3fa3e64529f10e975e86b51a84ec
Author: Simon South <[email protected]>
Date:   2015-07-28T14:12:26Z

    c_glib: Compiler: Do not try to convert between function, void pointers

----


> c_glib: Generated code tries to convert between function and void pointers
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-3273
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3273
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Compiler
>    Affects Versions: 0.9.3
>         Environment: Fedora 22 (gcc 5.1.1) on x86_64
>            Reporter: Simon South
>            Assignee: Simon South
>            Priority: Minor
>              Labels: c_glib, compiler
>
> In code generated by the compiler for C (GLib), a service's processor class 
> incorrectly treats function and void pointers as interchangeable: When adding 
> to the {{process_map}} hash table it supplies a pointer to a function, while 
> {{g_hash_table_insert}} expects a {{gpointer}} (effectively {{void *}}) to a 
> data object.
> ISO C explicitly forbids this conversion as it is not compatible with all 
> architectures, and with its {{-pedantic}} option enabled gcc will generate 
> warnings like
> {code}
> gen-c_glib/calculator.c: In function 'calculator_processor_init':
> gen-c_glib/calculator.c:1231:24: warning: ISO C forbids passing argument 3 of 
> 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
>                         calculator_processor_process_ping);
> {code}
> The compiler needs to be fixed so the code it generates does not try to use 
> function pointers where data (void) pointers are expected.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to