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

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

simonsouth opened a new pull request #1609: THRIFT-4648: Use correct namespace 
in type names
URL: https://github.com/apache/thrift/pull/1609
 
 
   These changes fix the C (Glib) compiler so it uses the correct namespace 
when generating the name of a type or an included header file:
   
   - The namespace of the target type or include is used, instead of the 
namespace of the IDL file being processed; and
   
   - An unreliable method of generating a fully-qualified class name, which 
fails when a type name begins with a lowercase letter, is replaced by code that 
constructs the class name explicitly using its namespace prefix.
   
   Also fixed is a minor issue whereby `t_c_glib_generator::init_generator()` 
would output multiple, extraneous comments in a generated file.
   
   This resolves 
[THRIFT-4648](https://issues.apache.org/jira/browse/THRIFT-4648).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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)

Reply via email to