This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Does anyone use -fprofile-use with C++?


Joe Buck <Joe.Buck@synopsys.COM> writes:

| On Thu, Apr 07, 2005 at 06:32:26PM -0400, Andrew Pinski wrote:
| > 
| > On Apr 7, 2005, at 6:01 PM, Daniel Kegel wrote:
| > 
| > >Judging by http://gcc.gnu.org/PR20815, I get the feeling
| > >not many people are using the -fprofile-generate
| > >and -fprofile-use options yet, at least not with
| > >C++, since it appears that namespaces make those options
| > >fall over...  It'd be nice to get this fixed for gcc-4.0
| > >(assuming it's a real bug and not just user error).
| > 
| > anonymous names are always problems,  as I wrote in the bug
| > you can use -frandom-seed=somenumber and it should fix the problem,
| > I have not tested it.
| 
| I think that the approach we took to anonymous namespaces is broken, and
| the names should be treated like C static,

More precisely a back-end notion of "static", not a real C static.
That is, that notion of static should *never be seen by the C++
front-end of any purpose*.

| except in cases where a
| real standard violation occurs.  It seems rather tricky to construct
| such a case, and the idea of producing random output "just in case"
| seems broken.


   struct S { };

   static void f(S) { }

   template<class T>
   void g(T t) { f(t); }

   int main() 
   { 
       S s; 
       g(s); // ERROR -- no f() can be found in instantiation
   }


Oh yes, GCC does not get it right but we know it should be fixed.
(and notice, no "export" was involved :-))

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]