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]

Re: GCC 3.0 Status Report


Hi GCC hackers,

I have some insight on a libstdc++ V3 problem that's been hitting hpux
and irix and solaris (the std::errno problem).  I wrote a long analysis
in PR libstdc++/2445.

I think the problem is in the attached patch fragment which was committed
on 2001-03-20.  It handles function names, and it handles global data
names, but it doesn't handle extern "C" data names within namespaces.
So this construct fails:

  namespace std { extern "C" int errno; }

The "errno" name shouldn't get mangled, but it does.

Michael Elizabeth Chastain
<chastain@redhat.com>
"love without fear"

===

diff -u -r -N 2001-03-20-14-00-00/source/gcc/cp/mangle.c 2001-03-20-14-05-00/source/gcc/cp/mangle.c
--- 2001-03-20-14-00-00/source/gcc/cp/mangle.c	Thu Feb 22 13:37:39 2001
+++ 2001-03-20-14-05-00/source/gcc/cp/mangle.c	Tue Mar 20 14:03:45 2001
@@ -2069,6 +2069,17 @@
 
   if (TREE_CODE (decl) == TYPE_DECL)
     write_type (TREE_TYPE (decl));
+  else if (/* The names of `extern "C"' functions are not mangled.  */
+	   (TREE_CODE (decl) == FUNCTION_DECL 
+	    /* If there's no DECL_LANG_SPECIFIC, it's a function built
+	       by language-independent code, which never builds
+	       functions with C++ linkage.  */
+	    && (!DECL_LANG_SPECIFIC (decl) 
+		|| DECL_EXTERN_C_FUNCTION_P (decl)))
+	   /* The names of global variables aren't mangled either.  */
+	   || (TREE_CODE (decl) == VAR_DECL
+	       && CP_DECL_CONTEXT (decl) == global_namespace))
+    write_string (IDENTIFIER_POINTER (DECL_NAME (decl)));
   else
     {
       write_mangled_name (decl);


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