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

C++ generator should topologically sort struct definitions and error on cycles

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++ - Compiler
    • None
    • Patch Available

    Description

      C++ (and maybe other languages?) treat Thrift struct-typed fields as plain struct members of the containing struct. Currently, the generator outputs the types in the same order as they're defined in the underlying Thrift field, which means that a file like:

      struct A {
        1: B foo;
      }
      struct B {
      }
      

      will generate C++ code that fails to compile.

      We should topologically-sort the structs before outputting the definitions so that the generated code compiles correctly.

      Attachments

        1. thrift-4846.patch
          7 kB
          Todd Lipcon

        Issue Links

          Activity

            People

              tlipcon Todd Lipcon
              tlipcon Todd Lipcon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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