You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Matej Kupljen (JIRA)" <ji...@apache.org> on 2018/10/05 09:40:00 UTC

[jira] [Created] (THRIFT-4648) c_glib namespaces incorrect includes

Matej Kupljen created THRIFT-4648:
-------------------------------------

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