This is the mail archive of the gcc-patches@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: [PATCH][2/2] Crude debug language selection for LTO


On Fri, 17 Sep 2010, Jason Merrill wrote:

> On 09/17/2010 07:14 AM, Richard Guenther wrote:
> > + 	  else if (strncmp (common_lang, "GNU C", 5) == 0
> > + 		   && strncmp (TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) ==
> > 0)
> > + 	    /* Mixing C and C++ is ok, use C++ in that case.  */
> > + 	    common_lang = "GNU C++";
> 
> Seems like this will give you C++ from mixing C and C.

Ooops, true.  Fixed with the following incremental patch.

Is allocating comp_unit_die lazily like done in that patch ok with you?

Thanks,
Richard.

Index: trunk/gcc/dwarf2out.c
===================================================================
--- trunk.orig/gcc/dwarf2out.c	2010-09-20 14:54:13.000000000 +0200
+++ trunk/gcc/dwarf2out.c	2010-09-20 14:53:13.000000000 +0200
@@ -19622,11 +19622,13 @@ gen_compile_unit_die (const char *filena
 	    continue;
 	  if (!common_lang)
 	    common_lang = TRANSLATION_UNIT_LANGUAGE (t);
+	  else if (strcmp (common_lang, TRANSLATION_UNIT_LANGUAGE (t)) == 0)
+	    ;
 	  else if (strncmp (common_lang, "GNU C", 5) == 0
 		   && strncmp (TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) == 0)
 	    /* Mixing C and C++ is ok, use C++ in that case.  */
 	    common_lang = "GNU C++";
-	  else if (strcmp (common_lang, TRANSLATION_UNIT_LANGUAGE (t)) != 0)
+	  else
 	    {
 	      /* Fall back to C.  */
 	      common_lang = NULL;


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