You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Zezeng Wang (Jira)" <ji...@apache.org> on 2020/04/07 07:04:00 UTC
[jira] [Updated] (THRIFT-5168) Useless generated code when .thrift
file only has service type
[ https://issues.apache.org/jira/browse/THRIFT-5168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zezeng Wang updated THRIFT-5168:
--------------------------------
Description:
When .thrift file only has service type, the generated code in _types.xx and _constants.xx is useless.
eg:
test.thrift:
service Foobar
{ void Test(1: i32 someValue = 42) }
test_types.h:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#ifndef test_TYPES_H
#define test_TYPES_H
#include <iosfwd>
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/TBase.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
#include <functional>
#include <memory>
#endif
test_types.cpp:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#include "test_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
test_constants.h:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#ifndef test_CONSTANTS_H
#define test_CONSTANTS_H
#include "test_types.h"
class testConstants
{ public: testConstants(); }
;
extern const testConstants g_test_constants;
#endif
test_constants.cpp:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#include "test_constants.h"
const testConstants g_test_constants;
testConstants::testConstants() {
}
was:
When .thrift file only has service type, the generated code in _types.xx and _constants.xx is useless.
eg:
test.thrift:
service Foobar {
void Test(1: i32 someValue = 42)
}
test_types.h:
/**
*Autogenerated by Thrift Compiler (0.14.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#ifndef test_TYPES_H
#define test_TYPES_H
#include <iosfwd>
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/TBase.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
#include <functional>
#include <memory>
#endif
test_types.cpp:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#include "test_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
test_constants.h:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#ifndef test_CONSTANTS_H
#define test_CONSTANTS_H
#include "test_types.h"
class testConstants
{ public: testConstants(); }
;
extern const testConstants g_test_constants;
#endif
test_constants.cpp:
/**
*Autogenerated by Thrift Compiler (0.14.0)
*DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*@generated
*/
#include "test_constants.h"
const testConstants g_test_constants;
testConstants::testConstants() {
}
> Useless generated code when .thrift file only has service type
> --------------------------------------------------------------
>
> Key: THRIFT-5168
> URL: https://issues.apache.org/jira/browse/THRIFT-5168
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Compiler
> Reporter: Zezeng Wang
> Priority: Major
>
> When .thrift file only has service type, the generated code in _types.xx and _constants.xx is useless.
>
> eg:
> test.thrift:
> service Foobar
> { void Test(1: i32 someValue = 42) }
>
> test_types.h:
> /**
> *Autogenerated by Thrift Compiler (0.14.0)
> *DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
> *@generated
> */
> #ifndef test_TYPES_H
> #define test_TYPES_H
> #include <iosfwd>
> #include <thrift/Thrift.h>
> #include <thrift/TApplicationException.h>
> #include <thrift/TBase.h>
> #include <thrift/protocol/TProtocol.h>
> #include <thrift/transport/TTransport.h>
> #include <functional>
> #include <memory>
>
>
> #endif
>
>
> test_types.cpp:
> /**
> *Autogenerated by Thrift Compiler (0.14.0)
> *DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
> *@generated
> */
> #include "test_types.h"
> #include <algorithm>
> #include <ostream>
> #include <thrift/TToString.h>
>
>
> test_constants.h:
> /**
> *Autogenerated by Thrift Compiler (0.14.0)
> *DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
> *@generated
> */
> #ifndef test_CONSTANTS_H
> #define test_CONSTANTS_H
> #include "test_types.h"
>
> class testConstants
> { public: testConstants(); }
> ;
> extern const testConstants g_test_constants;
>
> #endif
>
>
> test_constants.cpp:
> /**
> *Autogenerated by Thrift Compiler (0.14.0)
> *DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
> *@generated
> */
> #include "test_constants.h"
>
> const testConstants g_test_constants;
> testConstants::testConstants() {
> }
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)