Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5168

Useless generated code when .thrift file only has service type

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: C++ - Compiler
    • Labels:
      None

      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() {
      }

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                zeshuai007 Zezeng Wang
                Reporter:
                zeshuai007 Zezeng Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m