thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon South (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4648) c_glib namespaces incorrect includes
Date Sun, 07 Oct 2018 17:47:00 GMT

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

Simon South commented on THRIFT-4648:
-------------------------------------

Looks like there are multiple issues with the C (GLib) compiler's handling of namespaces. Attempting
to build the source code generated from Matej's IDL files using the latest compiler from git
produces this output:
{noformat}
gen-c_glib/f_first_types.c: In function ‘ffirst_set_property’:
gen-c_glib/f_first_types.c:136:18: warning: implicit declaration of function ‘FFIRST’;
did you mean ‘F_FIRST’? [-Wimplicit-function-declaration]
 Ffirst *self = FFIRST (object);
 ^~~~~~
 F_FIRST
gen-c_glib/f_first_types.c:136:18: warning: initialization of ‘Ffirst *’ {aka ‘struct
_Ffirst *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
gen-c_glib/f_first_types.c: In function ‘ffirst_get_property’:
gen-c_glib/f_first_types.c:157:18: warning: initialization of ‘Ffirst *’ {aka ‘struct
_Ffirst *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 Ffirst *self = FFIRST (object);
 ^~~~~~
gen-c_glib/f_first_types.c: In function ‘ffirst_class_init’:
gen-c_glib/f_first_types.c:195:24: error: ‘ffirst_read’ undeclared (first use in this
function); did you mean ‘f_first_read’?
 struct_class->read = ffirst_read;
 ^~~~~~~~~~~
 f_first_read
gen-c_glib/f_first_types.c:195:24: note: each undeclared identifier is reported only once
for each function it appears in
gen-c_glib/f_first_types.c:196:25: error: ‘ffirst_write’ undeclared (first use in this
function); did you mean ‘f_first_write’?
 struct_class->write = ffirst_write;
 ^~~~~~~~~~~~
 f_first_write
gen-c_glib/f_first_types.c:198:29: error: ‘ffirst_finalize’ undeclared (first use in this
function); did you mean ‘f_first_finalize’?
 gobject_class->finalize = ffirst_finalize;
 ^~~~~~~~~~~~~~~
 f_first_finalize
gen-c_glib/f_first_types.c: In function ‘f_first_get_type’:
gen-c_glib/f_first_types.c:226:24: error: ‘f_first_class_init’ undeclared (first use in
this function); did you mean ‘ffirst_class_init’?
 (GClassInitFunc) f_first_class_init,
 ^~~~~~~~~~~~~~~~~~
 ffirst_class_init
In file included from gen-c_glib/s_second_types.c:10:
gen-c_glib/s_second_types.h:15:10: fatal error: s_first_types.h: No such file or directory
 #include "s_first_types.h"
 ^~~~~~~~~~~~~~~~~
compilation terminated.
{noformat}
I'm investigating.

> c_glib namespaces incorrect includes
> ------------------------------------
>
>                 Key: THRIFT-4648
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4648
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Compiler
>    Affects Versions: 1.0
>         Environment: Thrift from GIT
> {noformat}
> $ ../build/compiler/cpp/bin/thrift --version
> Thrift version 1.0.0-dev
> {noformat}
> OS:
> {noformat}
> $ cat /etc/lsb-release 
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=18.04
> DISTRIB_CODENAME=bionic
> DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
> {noformat}
>            Reporter: Matej Kupljen
>            Assignee: Simon South
>            Priority: Major
>         Attachments: first.thrift, second.thrift
>
>
> When using namespaces for c_glib compiler generates incorrect code for #includes.
> Example:
> first.thrift
> {code:c}
> namespace c_glib F
>   
> struct first {
>         1: i32 test
> }
> {code}
> and second.thrift
> {code:c}
> namespace c_glib S
>   
> include "first.thrift"
> struct second {
>         1: first.first second
> }
> {code}
> As you can see, we use namespace F in first.thrift and namespace S in second.thrift.
> The compiler generates correct file names for those thrifts:
> {noformat}
> $ ls gen-c_glib/
> f_first_types.c  f_first_types.h  s_second_types.c  s_second_types.h
> {noformat}
> However, when generating s_second_types.h it uses namespace from second.thrift instead
of the one defined for first.thrift when generating #include statement.
> {code:c}
> /* base includes */
> #include <glib-object.h>
> #include <thrift/c_glib/thrift_struct.h>
> #include <thrift/c_glib/protocol/thrift_protocol.h>
> /* other thrift includes */
> #include "s_first_types.h"
> {code}
> It should use #include "f_first_types.h"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message