Message ID | alpine.LNX.2.00.1009201453160.8982@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On 09/20/2010 08:54 AM, Richard Guenther wrote: > 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? Yep. OK with this fix. Jason
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;