Re: namespaces/tempates and dictionary creation

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Tue, 07 Feb 2006 18:23:13 +0100


Hi Costas,

the attached patch fixes that. You can apply it to your ROOT sources using

patch -p0 < rootcint_nested_namespace.diff; make skip bin/rootcint

It should also appear in ROOT's CVS soon. Thanks for reporting.

FYI: in some occasions, rootcint created invalid dictionary sources for nested namespaces.

Cheers, Axel.

Costas Andreopoulos wrote:
> Hello all,
>
> while migrating my MC generator http://www.genie-mc.org
> from ROOT 4.04 to 5.09 I hit a problem with CINT.
> It seems that it gets confused and fails to build the
> dictionary in a case that I use templated classes behind
> namespaces.
>
> A small example that, I believe, reproduces the problem
> can be found at:
> http://hepunx.rl.ac.uk/~candreop/outbox/root5-problem.tar.gz
>
> cheers,
> Costas
>

Index: utils/src/rootcint.cxx



RCS file: /user/cvs/root/utils/src/rootcint.cxx,v retrieving revision 1.233
diff -p -u -r1.233 rootcint.cxx
--- utils/src/rootcint.cxx	3 Feb 2006 15:48:16 -0000	1.233
+++ utils/src/rootcint.cxx	7 Feb 2006 17:17:56 -0000
@@ -2080,8 +2080,11 @@ void WriteClassFunctions(G__ClassInfo &c
      clsname.erase (0, nsname.size() + 2);
    }  
    (*dictSrcOut) << "//_______________________________________"
        << "_______________________________________" << std::endl;
@@ -2131,8 +2134,10 @@ void WriteClassFunctions(G__ClassInfo &c
           << "}" << std::endl << std::endl;
    }  
 //______________________________________________________________________________
@@ -2535,8 +2540,11 @@ void WriteStreamer(G__ClassInfo &cl)
      clsname.erase (0, nsname.size() + 2);
    }  
    (*dictSrcOut) << "//_______________________________________"
        << "_______________________________________" << std::endl;
@@ -2871,8 +2879,10 @@ void WriteStreamer(G__ClassInfo &cl)

    (*dictSrcOut) << " }" << std::endl

        << "}" << std::endl << std::endl;  

 //______________________________________________________________________________
@@ -2898,8 +2908,11 @@ void WriteAutoStreamer(G__ClassInfo &cl)
      clsname.erase (0, nsname.size() + 2);
    }  
    (*dictSrcOut) << "//_______________________________________"
        << "_______________________________________" << std::endl;
@@ -2914,8 +2927,10 @@ void WriteAutoStreamer(G__ClassInfo &cl)
        << "   }" << std::endl
        << "}" << std::endl << std::endl;
 
 //______________________________________________________________________________
@@ -3411,8 +3426,11 @@ void WriteShowMembers(G__ClassInfo &cl, 
         clsname.erase (0, nsname.size() + 2);
       }
       int add_template_keyword = NeedTemplateKeyword(cl);
-      if (!nsname.empty())
-        (*dictSrcOut) << "namespace " << nsname << " {"  << std::endl;
+      int enclSpaceNesting = 0;
+      if (!nsname.empty()) {
+         G__ShadowMaker nestTempShadowMaker(*dictSrcOut, "");
+         enclSpaceNesting = nestTempShadowMaker.WriteNamespaceHeader(cl);
+      }
       if (add_template_keyword) (*dictSrcOut) << "template <> ";
       (*dictSrcOut) << "void " << clsname << "::ShowMembers(TMemberInspector &R__insp, char *R__parent)" 
           << std::endl << "{" << std::endl;
@@ -3426,9 +3444,11 @@ void WriteShowMembers(G__ClassInfo &cl, 
       }
       (*dictSrcOut) << "}" << std::endl << std::endl;
 
-      if (!nsname.empty())
-        (*dictSrcOut) << "} // namespace "<< nsname << std::endl;
-   }
+      while (enclSpaceNesting) {
+         (*dictSrcOut) << "} // namespace " << nsname << std::endl;
+         --enclSpaceNesting;
+      }

+ }
 }  
 //______________________________________________________________________________
Received on Tue Feb 07 2006 - 18:23:19 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET