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


> It's not a patch -- the patch fragment you see is the patch that
> broke g++ (I think).  I don't know enough about g++ data structures
> to write a good patch.

Here is a fix for the undefined reference std::errno.  The language
experts can debate whether it is the right thing to do.  I have checked
that `namespace std { extern "C" int errno; }' is not mangled under
hpux and I don't see any regressions of the libstdc++ or g++ testsuite
under i686 linux.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-04-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* mangle.c (mangle_decl_string): Don't mangle variables with
	extern "C" linkage.
	* decl.c (grokvardecl): Use full language declaration for `extern'
	variables.

--- mangle.c.orig	Tue Apr 17 14:38:43 2001
+++ mangle.c	Wed Apr 18 20:29:54 2001
@@ -2093,9 +2093,11 @@
 	       functions with C++ linkage.  */
 	    && (!DECL_LANG_SPECIFIC (decl) 
 		|| DECL_EXTERN_C_FUNCTION_P (decl)))
-	   /* The names of global variables aren't mangled either.  */
+	   /* The names of global and extern "C" variables aren't
+	      mangled either.  */
 	   || (TREE_CODE (decl) == VAR_DECL
-	       && CP_DECL_CONTEXT (decl) == global_namespace))
+	       && (CP_DECL_CONTEXT (decl) == global_namespace
+		   || (DECL_LANG_SPECIFIC (decl) && DECL_EXTERN_C_P (decl)))))
     write_string (IDENTIFIER_POINTER (DECL_NAME (decl)));
   else
     {
--- decl.c.orig	Mon Apr 16 17:58:53 2001
+++ decl.c	Thu Apr 19 14:58:37 2001
@@ -9022,9 +9022,10 @@
       else
 	context = NULL_TREE;
 
-      if (processing_template_decl && context)
-	/* For global variables, declared in a template, we need the
-	   full lang_decl.  */
+      if (RIDBIT_SETP (RID_EXTERN, specbits)
+	  || (processing_template_decl && context))
+	/* For `extern' variables or variables declared in a template,
+	   we need the full lang_decl.  */
 	decl = build_lang_decl (VAR_DECL, declarator, type);
       else
 	decl = build_decl (VAR_DECL, declarator, type);


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