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

thrift: always prefix namespaces with " ::"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.8
    • C++ - Library
    • None

    Description

      From d56203d414d23c7858a269e4aa547ee3164832fd Mon Sep 17 00:00:00 2001
      From: Adam Simpkins <simpkins@fb.com>
      Date: Thu, 4 Mar 2010 00:53:37 +0000
      Subject: [PATCH 07/33] thrift: always prefix namespaces with " ::"

      Summary:
      Thrift always refers to namespaces using their full name. Therefore, it
      should prefix them with "::" to avoid accidentally matching a name
      defined in one of the current namespaces, rather than at the top-level.

      For example, if ServiceB is in namespace bar, and inherits from ServiceA
      in namespace foo, all code emitted for ServiceB now refers to ServiceA
      as ::foo::ServiceA instead of just foo::ServiceA. This allows the code
      to compile even if a namespace ::bar::foo also exists.

      An extra leading whitespace is also emitted, which is needed in cases
      when the name is used as the first template parameter, so that the
      emitted code contains "< ::" instead of "<::".

      Test Plan:
      jsong reported a build problem because of this name lookup error, and
      this change fixed his build.

      I also tested building [internal fb thing] and [internal fb thing], and they both built
      successfully.

      Tags: thrift


      compiler/cpp/src/generate/t_cpp_generator.cc | 11 +++++++++--
      1 files changed, 9 insertions, 2 deletions

      Attachments

        Activity

          People

            davejwatson@fb Dave Watson
            davejwatson@fb Dave Watson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: