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

Invalid Cpp generated for include guards from valid Thrift IDL when the file name has characters that are not valid in a c++ #define

    XMLWordPrintableJSON

Details

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

    Description

      I classify this as a bug as valid Thrift file silently generates invalid C++ code. Feel free to change the issue type if you disagree.

      I use a a namespace hierarchy for my Thrift data model. When writing nested namespaces, I tend to represent to parent-child relationship of these namespaces in their the containing file names.

      So for example, I have the following relationship:

      • namespace "base" defined in file "base.thrift"
      • name "base.net" defined in file "base.net.thrift"

      Note that this convention of using dots to separate namespaces seems consistent with Thrift namespace syntax.

      The generated Cpp header for the base.net namespace does not compile: the include guard variable name uses the dot which is not valid C++ syntax.

      I think the Cpp compiler should replace dots with underscores when generating the include guard.

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rohel01 Michaël Melchiore
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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