thrift: always prefix namespaces with " ::"

---------------------------------------------

                 Key: THRIFT-1275
                 URL: https://issues.apache.org/jira/browse/THRIFT-1275
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Library
            Reporter: Dave Watson
            Priority: Minor


>From d56203d414d23c7858a269e4aa547ee3164832fd Mon Sep 17 00:00:00 2001
From: Adam Simpkins <simpk...@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(-)



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to